diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 18 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/process.c | 16 |
3 files changed, 25 insertions, 10 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 |
diff --git a/src/lisp.h b/src/lisp.h index b2449cb87d3..05d1cd8201a 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4031,6 +4031,7 @@ extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object, | |||
| 4031 | extern void close_file_unwind (int); | 4031 | extern void close_file_unwind (int); |
| 4032 | extern void fclose_unwind (void *); | 4032 | extern void fclose_unwind (void *); |
| 4033 | extern void restore_point_unwind (Lisp_Object); | 4033 | extern void restore_point_unwind (Lisp_Object); |
| 4034 | extern Lisp_Object get_file_errno_data (const char *, Lisp_Object, int); | ||
| 4034 | extern _Noreturn void report_file_errno (const char *, Lisp_Object, int); | 4035 | extern _Noreturn void report_file_errno (const char *, Lisp_Object, int); |
| 4035 | extern _Noreturn void report_file_error (const char *, Lisp_Object); | 4036 | extern _Noreturn void report_file_error (const char *, Lisp_Object); |
| 4036 | extern _Noreturn void report_file_notify_error (const char *, Lisp_Object); | 4037 | extern _Noreturn void report_file_notify_error (const char *, Lisp_Object); |
diff --git a/src/process.c b/src/process.c index 8629f834e79..676f38446e4 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3578,17 +3578,23 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, | |||
| 3578 | 3578 | ||
| 3579 | if (s < 0) | 3579 | if (s < 0) |
| 3580 | { | 3580 | { |
| 3581 | const char *err = (p->is_server | ||
| 3582 | ? "make server process failed" | ||
| 3583 | : "make client process failed"); | ||
| 3584 | |||
| 3581 | /* If non-blocking got this far - and failed - assume non-blocking is | 3585 | /* If non-blocking got this far - and failed - assume non-blocking is |
| 3582 | not supported after all. This is probably a wrong assumption, but | 3586 | not supported after all. This is probably a wrong assumption, but |
| 3583 | the normal blocking calls to open-network-stream handles this error | 3587 | the normal blocking calls to open-network-stream handles this error |
| 3584 | better. */ | 3588 | better. */ |
| 3585 | if (p->is_non_blocking_client) | 3589 | if (p->is_non_blocking_client) |
| 3586 | return; | 3590 | { |
| 3591 | Lisp_Object data = get_file_errno_data (err, contact, xerrno); | ||
| 3592 | |||
| 3593 | pset_status (p, list2 (Fcar (data), Fcdr (data))); | ||
| 3594 | return; | ||
| 3595 | } | ||
| 3587 | 3596 | ||
| 3588 | report_file_errno ((p->is_server | 3597 | report_file_errno (err, contact, xerrno); |
| 3589 | ? "make server process failed" | ||
| 3590 | : "make client process failed"), | ||
| 3591 | contact, xerrno); | ||
| 3592 | } | 3598 | } |
| 3593 | 3599 | ||
| 3594 | inch = s; | 3600 | inch = s; |