diff options
| author | Lars Ingebrigtsen | 2018-07-22 13:39:10 +0200 |
|---|---|---|
| committer | Noam Postavsky | 2018-08-08 19:30:50 -0400 |
| commit | 18588bce36617179cc7c8af74a6197c8e16819ea (patch) | |
| tree | 68b05b7913d46d76bccdf9c19f8f42d6f5d20024 /src/fileio.c | |
| parent | 5afbf62674e741b06c01216fe37a5439e9d42307 (diff) | |
| download | emacs-18588bce36617179cc7c8af74a6197c8e16819ea.tar.gz emacs-18588bce36617179cc7c8af74a6197c8e16819ea.zip | |
Make async :family 'local failures fail correctly again
* src/fileio.c (get_file_errno_data): Refactor out into its own
function so that we can reuse the error handling from an async
context (bug#31901).
* src/process.c (connect_network_socket): When an async :family
'local client fails (with a file error, for instance), mark the
process as failed.
(cherry picked from commit 92ba34d89ac4f5b5bbb818e1c39a3cc12a405790)
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/fileio.c b/src/fileio.c index 9dbe3ad788e..e2be7fe2c69 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -195,8 +195,8 @@ check_writable (const char *filename, int amode) | |||
| 195 | list before reporting it; this saves report_file_errno's caller the | 195 | list before reporting it; this saves report_file_errno's caller the |
| 196 | trouble of preserving errno before calling list1. */ | 196 | trouble of preserving errno before calling list1. */ |
| 197 | 197 | ||
| 198 | void | 198 | Lisp_Object |
| 199 | report_file_errno (char const *string, Lisp_Object name, int errorno) | 199 | get_file_errno_data (char const *string, Lisp_Object name, int errorno) |
| 200 | { | 200 | { |
| 201 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); | 201 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); |
| 202 | char *str = emacs_strerror (errorno); | 202 | char *str = emacs_strerror (errorno); |
| @@ -206,10 +206,18 @@ report_file_errno (char const *string, Lisp_Object name, int errorno) | |||
| 206 | Lisp_Object errdata = Fcons (errstring, data); | 206 | Lisp_Object errdata = Fcons (errstring, data); |
| 207 | 207 | ||
| 208 | if (errorno == EEXIST) | 208 | if (errorno == EEXIST) |
| 209 | xsignal (Qfile_already_exists, errdata); | 209 | return Fcons (Qfile_already_exists, errdata); |
| 210 | else | 210 | else |
| 211 | xsignal (errorno == ENOENT ? Qfile_missing : Qfile_error, | 211 | return Fcons (errorno == ENOENT ? Qfile_missing : Qfile_error, |
| 212 | Fcons (build_string (string), errdata)); | 212 | Fcons (build_string (string), errdata)); |
| 213 | } | ||
| 214 | |||
| 215 | void | ||
| 216 | report_file_errno (char const *string, Lisp_Object name, int errorno) | ||
| 217 | { | ||
| 218 | Lisp_Object data = get_file_errno_data (string, name, errorno); | ||
| 219 | |||
| 220 | xsignal (Fcar (data), Fcdr (data)); | ||
| 213 | } | 221 | } |
| 214 | 222 | ||
| 215 | /* Signal a file-access failure that set errno. STRING describes the | 223 | /* Signal a file-access failure that set errno. STRING describes the |