diff options
author | Paul Smith <psmith@gnu.org> | 2022-11-07 15:55:21 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-11-13 10:39:48 -0500 |
commit | 4c9d87f4ae938a20fc21d2a0538c74dad0518f20 (patch) | |
tree | 0e55d21729c36dfc04d56fbfb0d53126a210ee25 /src | |
parent | bb5df351330e677892818bb3c7f962b606082278 (diff) | |
download | make-git-4c9d87f4ae938a20fc21d2a0538c74dad0518f20.tar.gz |
Keep going if we can't connect to the jobserver
* src/posixos.c (jobserver_parse_auth): Don't invoke fatal() if we
can't connect to an existing jobserver: just keep going without it.
* src/w32/w32os.c (jobserver_parse_auth): Ditto.
* tests/scripts/features/jobserver: Add a test for invalid FIFO
auth files.
Diffstat (limited to 'src')
-rw-r--r-- | src/posixos.c | 23 | ||||
-rw-r--r-- | src/w32/w32os.c | 10 |
2 files changed, 20 insertions, 13 deletions
diff --git a/src/posixos.c b/src/posixos.c index 44aeb346..3d7d6614 100644 --- a/src/posixos.c +++ b/src/posixos.c @@ -167,12 +167,12 @@ jobserver_setup (int slots, const char *style) hang until the write side is open. */ EINTRLOOP (job_fds[0], open (fifo_name, O_RDONLY|O_NONBLOCK)); if (job_fds[0] < 0) - OSS (fatal, NILF, _("Cannot open jobserver %s: %s"), + OSS (fatal, NILF, _("cannot open jobserver %s: %s"), fifo_name, strerror (errno)); EINTRLOOP (job_fds[1], open (fifo_name, O_WRONLY)); if (job_fds[0] < 0) - OSS (fatal, NILF, _("Cannot open jobserver %s: %s"), + OSS (fatal, NILF, _("cannot open jobserver %s: %s"), fifo_name, strerror (errno)); js_type = js_fifo; @@ -183,7 +183,7 @@ jobserver_setup (int slots, const char *style) if (js_type == js_none) { if (style && strcmp (style, "pipe") != 0) - OS (fatal, NILF, _("Unknown jobserver auth style '%s'"), style); + OS (fatal, NILF, _("unknown jobserver auth style '%s'"), style); EINTRLOOP (r, pipe (job_fds)); if (r < 0) @@ -229,14 +229,19 @@ jobserver_parse_auth (const char *auth) EINTRLOOP (job_fds[0], open (fifo_name, O_RDONLY)); if (job_fds[0] < 0) - OSS (fatal, NILF, - _("Cannot open jobserver %s: %s"), fifo_name, strerror (errno)); + { + OSS (error, NILF, + _("cannot open jobserver %s: %s"), fifo_name, strerror (errno)); + return 0; + } EINTRLOOP (job_fds[1], open (fifo_name, O_WRONLY)); - if (job_fds[0] < 0) - OSS (fatal, NILF, - _("Cannot open jobserver %s: %s"), fifo_name, strerror (errno)); - + if (job_fds[1] < 0) + { + OSS (error, NILF, + _("cannot open jobserver %s: %s"), fifo_name, strerror (errno)); + return 0; + } js_type = js_fifo; } /* If not, it must be a simple pipe. */ diff --git a/src/w32/w32os.c b/src/w32/w32os.c index 9c5dec24..213bbf12 100644 --- a/src/w32/w32os.c +++ b/src/w32/w32os.c @@ -216,12 +216,12 @@ jobserver_setup (int slots, const char *style) /* sub_proc.c is limited in the number of objects it can wait for. */ if (style && strcmp (style, "sem") != 0) - OS (fatal, NILF, _("Unknown jobserver auth style '%s'"), style); + OS (fatal, NILF, _("unknown jobserver auth style '%s'"), style); if (slots > process_table_usable_size()) { slots = process_table_usable_size(); - DB (DB_JOBS, (_("Jobserver slots limited to %d\n"), slots)); + DB (DB_JOBS, (_("jobserver slots limited to %d\n"), slots)); } sprintf (jobserver_semaphore_name, "gmake_semaphore_%d", _getpid ()); @@ -255,10 +255,12 @@ jobserver_parse_auth (const char *auth) { DWORD err = GetLastError (); const char *estr = map_windows32_error_to_string (err); - fatal (NILF, strlen (auth) + INTSTR_LENGTH + strlen (estr), - _("internal error: unable to open jobserver semaphore '%s': (Error %ld: %s)"), + error (NILF, strlen (auth) + INTSTR_LENGTH + strlen (estr), + _("unable to open jobserver semaphore '%s': (Error %ld: %s)"), auth, err, estr); + return 0; } + DB (DB_JOBS, (_("Jobserver client (semaphore %s)\n"), auth)); return 1; |