summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-08-01 17:24:28 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-08-01 17:24:50 -0700
commit1a65afb7ecc2a52127d6164bad19313440237f9d (patch)
treecebf29b8dbbcec14fbdb1e8c13b143334c8fbca6 /src/keyboard.c
parentf74164a845eff579635da0a1267514ef9d040ad2 (diff)
downloademacs-1a65afb7ecc2a52127d6164bad19313440237f9d.tar.gz
Don’t worry about unlink if errno == ENOENT
* 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.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 804af85dad9..97069a24acc 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10168,7 +10168,8 @@ This may include sensitive information such as passwords. */)
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)