diff options
| author | Paul Eggert | 2017-08-01 17:24:28 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-08-01 17:24:50 -0700 |
| commit | 1a65afb7ecc2a52127d6164bad19313440237f9d (patch) | |
| tree | cebf29b8dbbcec14fbdb1e8c13b143334c8fbca6 /src | |
| parent | f74164a845eff579635da0a1267514ef9d040ad2 (diff) | |
| download | emacs-1a65afb7ecc2a52127d6164bad19313440237f9d.tar.gz emacs-1a65afb7ecc2a52127d6164bad19313440237f9d.zip | |
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')
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/fileio.c b/src/fileio.c index a57d50b24e0..7531214fe45 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2216,7 +2216,7 @@ With a prefix argument, TRASH is nil. */) | |||
| 2216 | 2216 | ||
| 2217 | encoded_file = ENCODE_FILE (filename); | 2217 | encoded_file = ENCODE_FILE (filename); |
| 2218 | 2218 | ||
| 2219 | if (unlink (SSDATA (encoded_file)) < 0) | 2219 | if (unlink (SSDATA (encoded_file)) != 0 && errno != ENOENT) |
| 2220 | report_file_error ("Removing old name", filename); | 2220 | report_file_error ("Removing old name", filename); |
| 2221 | return Qnil; | 2221 | return Qnil; |
| 2222 | } | 2222 | } |
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. */) | |||
| 10168 | file = Fexpand_file_name (file, Qnil); | 10168 | file = Fexpand_file_name (file, Qnil); |
| 10169 | encfile = ENCODE_FILE (file); | 10169 | encfile = ENCODE_FILE (file); |
| 10170 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); | 10170 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); |
| 10171 | if (fd < 0 && errno == EEXIST && unlink (SSDATA (encfile)) == 0) | 10171 | if (fd < 0 && errno == EEXIST |
| 10172 | && (unlink (SSDATA (encfile)) == 0 || errno == ENOENT)) | ||
| 10172 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); | 10173 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); |
| 10173 | dribble = fd < 0 ? 0 : fdopen (fd, "w"); | 10174 | dribble = fd < 0 ? 0 : fdopen (fd, "w"); |
| 10174 | if (dribble == 0) | 10175 | if (dribble == 0) |