From: Bruno Haible Date: Fri, 13 Jun 2003 13:04:23 +0000 (+0000) Subject: Adjust for wait_subprocess change. X-Git-Tag: v0.13~450 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6ef9b6563f32adba6179214438912d062bdfb07;p=thirdparty%2Fgettext.git Adjust for wait_subprocess change. Avoid msginit failure if one of the shell scripts is not present. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 56090796a..f237a9ab8 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,14 @@ +2003-06-13 Bruno Haible + + * msgexec.c (process_string): Pass null_stderr=false. + * msgfilter.c (process_string): Likewise. + * msggrep.c (is_string_selected): Likewise. + * read-java.c (execute_and_read_po_output): Likewise. + * read-tcl.c (msgdomain_read_tcl): Likewise. + * msginit.c (project_id, project_id_version, get_user_email, + language_team_address): Return a default value if the subprocess + fails, instead of exiting. + 2003-06-12 Bruno Haible * Makefile.am (noinst_HEADERS): Add x-perl.h. diff --git a/gettext-tools/src/msgexec.c b/gettext-tools/src/msgexec.c index 8e98aa4fc..a53a333d9 100644 --- a/gettext-tools/src/msgexec.c +++ b/gettext-tools/src/msgexec.c @@ -334,7 +334,7 @@ process_string (const message_ty *mp, const char *str, size_t len) close (fd[0]); /* Remove zombie process from process list, and retrieve exit status. */ - exitstatus = wait_subprocess (child, sub_name, true); + exitstatus = wait_subprocess (child, sub_name, false, true); if (exitcode < exitstatus) exitcode = exitstatus; } diff --git a/gettext-tools/src/msgfilter.c b/gettext-tools/src/msgfilter.c index 075b0ca8d..55455b2b2 100644 --- a/gettext-tools/src/msgfilter.c +++ b/gettext-tools/src/msgfilter.c @@ -657,7 +657,7 @@ process_string (const char *str, size_t len, char **resultp, size_t *lengthp) close (fd[0]); /* Remove zombie process from process list. */ - exitstatus = wait_subprocess (child, sub_name, true); + exitstatus = wait_subprocess (child, sub_name, false, true); if (exitstatus != 0) error (EXIT_FAILURE, 0, _("%s subprocess terminated with exit code %d"), sub_name, exitstatus); diff --git a/gettext-tools/src/msggrep.c b/gettext-tools/src/msggrep.c index f6928a526..940b46dbd 100644 --- a/gettext-tools/src/msggrep.c +++ b/gettext-tools/src/msggrep.c @@ -583,7 +583,7 @@ is_string_selected (int grep_pass, const char *str, size_t len) close (fd[0]); /* Remove zombie process from process list, and retrieve exit status. */ - exitstatus = wait_subprocess (child, "grep", true); + exitstatus = wait_subprocess (child, "grep", false, true); return (exitstatus == 0); } else diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index c348eaf69..ace4a8347 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -897,29 +897,43 @@ project_id () argv[0] = "/bin/sh"; argv[1] = prog; argv[2] = NULL; - child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, true, fd); + child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, false, fd); + if (child == -1) + goto failed; /* Retrieve its result. */ fp = fdopen (fd[0], "r"); if (fp == NULL) - error (EXIT_FAILURE, errno, _("fdopen() failed")); + { + error (0, errno, _("fdopen() failed")); + goto failed; + } line = NULL; linesize = 0; linelen = getline (&line, &linesize, fp); if (linelen == (size_t)(-1)) - error (EXIT_FAILURE, 0, _("%s subprocess I/O error"), prog); + { + error (0, 0, _("%s subprocess I/O error"), prog); + goto failed; + } if (linelen > 0 && line[linelen - 1] == '\n') line[linelen - 1] = '\0'; fclose (fp); /* Remove zombie process from process list, and retrieve exit status. */ - exitstatus = wait_subprocess (child, prog, true); + exitstatus = wait_subprocess (child, prog, false, false); if (exitstatus != 0) - error (EXIT_FAILURE, 0, _("%s subprocess failed with exit code %d"), - prog, exitstatus); + { + error (0, 0, _("%s subprocess failed with exit code %d"), + prog, exitstatus); + goto failed; + } return line; + +failed: + return "PACKAGE"; } @@ -949,29 +963,43 @@ project_id_version () argv[1] = prog; argv[2] = "yes"; argv[3] = NULL; - child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, true, fd); + child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, false, fd); + if (child == -1) + goto failed; /* Retrieve its result. */ fp = fdopen (fd[0], "r"); if (fp == NULL) - error (EXIT_FAILURE, errno, _("fdopen() failed")); + { + error (0, errno, _("fdopen() failed")); + goto failed; + } line = NULL; linesize = 0; linelen = getline (&line, &linesize, fp); if (linelen == (size_t)(-1)) - error (EXIT_FAILURE, 0, _("%s subprocess I/O error"), prog); + { + error (0, 0, _("%s subprocess I/O error"), prog); + goto failed; + } if (linelen > 0 && line[linelen - 1] == '\n') line[linelen - 1] = '\0'; fclose (fp); /* Remove zombie process from process list, and retrieve exit status. */ - exitstatus = wait_subprocess (child, prog, true); + exitstatus = wait_subprocess (child, prog, false, false); if (exitstatus != 0) - error (EXIT_FAILURE, 0, _("%s subprocess failed with exit code %d"), - prog, exitstatus); + { + error (0, 0, _("%s subprocess failed with exit code %d"), + prog, exitstatus); + goto failed; + } return line; + +failed: + return "PACKAGE VERSION"; } @@ -1092,29 +1120,43 @@ The new message catalog should contain your email address, so that users can\n\ give you feedback about the translations, and so that maintainers can contact\n\ you in case of unexpected technical problems.\n"); argv[3] = NULL; - child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, true, fd); + child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, false, fd); + if (child == -1) + goto failed; /* Retrieve his answer. */ fp = fdopen (fd[0], "r"); if (fp == NULL) - error (EXIT_FAILURE, errno, _("fdopen() failed")); + { + error (0, errno, _("fdopen() failed")); + goto failed; + } line = NULL; linesize = 0; linelen = getline (&line, &linesize, fp); if (linelen == (size_t)(-1)) - error (EXIT_FAILURE, 0, _("%s subprocess I/O error"), prog); + { + error (0, 0, _("%s subprocess I/O error"), prog); + goto failed; + } if (linelen > 0 && line[linelen - 1] == '\n') line[linelen - 1] = '\0'; fclose (fp); /* Remove zombie process from process list, and retrieve exit status. */ - exitstatus = wait_subprocess (child, prog, true); + exitstatus = wait_subprocess (child, prog, false, false); if (exitstatus != 0) - error (EXIT_FAILURE, 0, _("%s subprocess failed with exit code %d"), - prog, exitstatus); + { + error (0, 0, _("%s subprocess failed with exit code %d"), + prog, exitstatus); + goto failed; + } return line; + +failed: + return "EMAIL@ADDRESS"; } @@ -1159,12 +1201,17 @@ language_team_address () argv[4] = (char *) catalogname; argv[5] = (char *) language; argv[6] = NULL; - child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, true, fd); + child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, false, fd); + if (child == -1) + goto failed; /* Retrieve its result. */ fp = fdopen (fd[0], "r"); if (fp == NULL) - error (EXIT_FAILURE, errno, _("fdopen() failed")); + { + error (0, errno, _("fdopen() failed")); + goto failed; + } line = NULL; linesize = 0; linelen = getline (&line, &linesize, fp); @@ -1176,12 +1223,18 @@ language_team_address () fclose (fp); /* Remove zombie process from process list, and retrieve exit status. */ - exitstatus = wait_subprocess (child, prog, true); + exitstatus = wait_subprocess (child, prog, false, false); if (exitstatus != 0) - error (EXIT_FAILURE, 0, _("%s subprocess failed with exit code %d"), - prog, exitstatus); + { + error (0, 0, _("%s subprocess failed with exit code %d"), + prog, exitstatus); + goto failed; + } return line; + +failed: + return ""; } diff --git a/gettext-tools/src/read-java.c b/gettext-tools/src/read-java.c index 5d9fbf132..0fdb177b1 100644 --- a/gettext-tools/src/read-java.c +++ b/gettext-tools/src/read-java.c @@ -76,7 +76,7 @@ execute_and_read_po_output (const char *progname, fclose (fp); /* Remove zombie process from process list, and retrieve exit status. */ - exitstatus = wait_subprocess (child, progname, true); + exitstatus = wait_subprocess (child, progname, false, true); if (exitstatus != 0) error (EXIT_FAILURE, 0, _("%s subprocess failed with exit code %d"), progname, exitstatus); diff --git a/gettext-tools/src/read-tcl.c b/gettext-tools/src/read-tcl.c index 38fdc07f0..b1253bff0 100644 --- a/gettext-tools/src/read-tcl.c +++ b/gettext-tools/src/read-tcl.c @@ -112,7 +112,7 @@ msgdomain_read_tcl (const char *locale_name, const char *directory) fclose (fp); /* Remove zombie process from process list, and retrieve exit status. */ - exitstatus = wait_subprocess (child, "tclsh", true); + exitstatus = wait_subprocess (child, "tclsh", false, true); if (exitstatus != 0) { if (exitstatus == 2)