(Fwrite_region): Be careful not to destroy contents of
authorRichard M. Stallman <rms@gnu.org>
Wed, 11 Dec 1996 00:29:18 +0000 (00:29 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 11 Dec 1996 00:29:18 +0000 (00:29 +0000)
existing file when appending.

src/fileio.c

index d8c0f26..20419fe 100644 (file)
@@ -3536,7 +3536,7 @@ to the file, instead of any buffer contents, and END is ignored.")
     desc = open (fn, O_WRONLY);
 #endif /* not DOS_NT */
 
-  if (desc < 0)
+  if (desc < 0 && (NILP (append) || errno == ENOENT) )
 #ifdef VMS
     if (auto_saving)    /* Overwrite any previous version of autosave file */
       {