]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Make it work on AIX and OSF/1.
authorBruno Haible <bruno@clisp.org>
Mon, 7 Jan 2002 17:34:05 +0000 (17:34 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 22:34:42 +0000 (00:34 +0200)
lib/ChangeLog
lib/wait-process.c

index ddc8919c517dd6de4da52d7fe7313f57065f3d13..1286b854c2e6dfc274c141ffba9bb4591b1c78f2 100644 (file)
@@ -1,3 +1,11 @@
+2002-01-05  Bruno Haible  <bruno@clisp.org>
+
+       * wait-process.c (WIFSIGNALED): Make it return false when WIFSTOPPED
+       returns true.
+       (wait_subprocess): Use WIFSIGNALED instead of WCOREDUMP || WTERMSIG.
+       On AIX and OSF/1, WTERMSIG has a negative value if !WIFSIGNALED. And
+       WCOREDUMP is a BSDism, not POSIX.
+
 2001-12-23  Bruno Haible  <bruno@clisp.org>
 
        * xsetenv.h: New file.
index 6946ebc97a8dc919322109f6c711ead31c23d631..cd4e3a0ef44ae0e74caafb1b76de561642a3577b 100644 (file)
@@ -1,5 +1,5 @@
 /* Waiting for a subprocess to finish.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
 # ifndef WEXITSTATUS
 #  define WEXITSTATUS(x) ((x).w_retcode)
 # endif
-# ifndef WIFSIGNALED
-#  define WIFSIGNALED(x) (WTERMSIG(x) != 0)
-# endif
-# ifndef WIFEXITED
-#  define WIFEXITED(x) (WTERMSIG(x) == 0)
-# endif
-# ifndef WIFSTOPPED
-#  define WIFSTOPPED(x) (WTERMSIG(x) == 0x7f)
-# endif
 #else
 # define WAIT_T int
 # ifndef WTERMSIG
 # ifndef WEXITSTATUS
 #  define WEXITSTATUS(x) (((x) >> 8) & 0xff)
 # endif
-# ifndef WIFSIGNALED
-#  define WIFSIGNALED(x) (WTERMSIG (x) != 0)
-# endif
-# ifndef WIFEXITED
-#  define WIFEXITED(x) (WTERMSIG (x) == 0)
-# endif
-# ifndef WIFSTOPPED
-#  define WIFSTOPPED(x) (WTERMSIG(x) == 0x7f)
-# endif
 #endif
+/* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x)
+   is true.  */
+#ifndef WIFSIGNALED
+# define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(x) (WTERMSIG (x) == 0)
+#endif
+#ifndef WIFSTOPPED
+# define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f)
+#endif
+/* Note that portable applications may access
+   WTERMSIG(x) only if WIFSIGNALED(x) is true, and
+   WEXITSTATUS(x) only if WIFEXITED(x) is true.  */
 
 #include "error.h"
 #include "exit.h"
@@ -116,14 +112,17 @@ wait_subprocess (child, progname, exit_on_error)
            return 127;
        }
 
+      /* One of WIFSIGNALED (status), WIFEXITED (status), WIFSTOPPED (status)
+        must always be true.  Loop until the program terminates.  */
       if (!WIFSTOPPED (status))
        break;
     }
 
-  if (WCOREDUMP (status) || WTERMSIG (status) != 0)
+  if (WIFSIGNALED (status))
     {
       if (exit_on_error)
-       error (EXIT_FAILURE, 0, _("%s subprocess got fatal signal"), progname);
+       error (EXIT_FAILURE, 0, _("%s subprocess got fatal signal %d"),
+              progname, (int) WTERMSIG (status));
       else
        return 127;
     }