--- z-file.org.c	2011-07-03 13:14:00.000000000 -0500
+++ z-file.c	2011-07-06 07:51:17.000000000 -0500
@@ -364,7 +364,24 @@
 
 	switch (mode)
 	{
-		case MODE_WRITE:  f->fh = fopen(buf, "wb"); break;
+		case MODE_WRITE:
+    { 
+      if (ftype == FTYPE_SAVE) {
+        /* open only if the file does not exist */
+        int fd;
+        fd = open(buf,
+          O_CREAT | O_EXCL | O_WRONLY | O_BINARY,
+          S_IREAD|S_IWRITE);
+        if (fd < 0) {
+          /* there was some error */
+          f->fh = NULL;
+        } else {
+          f->fh = fdopen(fd, "wb");
+        }
+      } else
+      f->fh = fopen(buf, "wb");
+      break;
+    }
 		case MODE_READ:   f->fh = fopen(buf, "rb"); break;
 		case MODE_APPEND: f->fh = fopen(buf, "a+"); break;
 		default:          f->fh = fopen(buf, "__");
