* src/fileio.c (Fdelete_file):
* src/keyboard.c (Fopen_dribble_file): Do not report failure to
remove a file if unlink fails with errno == ENOENT. This can
happen even if Emacs is the only program removing the file, in
case an NFS cache overflows. The file does not exist if errno ==
ENOENT, so it is OK to proceed.
encoded_file = ENCODE_FILE (filename);
- if (unlink (SSDATA (encoded_file)) < 0)
+ if (unlink (SSDATA (encoded_file)) != 0 && errno != ENOENT)
report_file_error ("Removing old name", filename);
return Qnil;
}
file = Fexpand_file_name (file, Qnil);
encfile = ENCODE_FILE (file);
fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600);
- if (fd < 0 && errno == EEXIST && unlink (SSDATA (encfile)) == 0)
+ if (fd < 0 && errno == EEXIST
+ && (unlink (SSDATA (encfile)) == 0 || errno == ENOENT))
fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600);
dribble = fd < 0 ? 0 : fdopen (fd, "w");
if (dribble == 0)