bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getopt-gnu: fix exit code overflow


From: Bruno Haible
Subject: getopt-gnu: fix exit code overflow
Date: Tue, 19 Jun 2012 12:11:56 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Exit codes are limited to be < 128. Values between 128 and 255 are reported
as core dumps by the invoking shell. To avoid such misinterpretations,
this fix. The problem was introduced on 2011-07-07.


2012-06-19  Bruno Haible  <address@hidden>

        getopt-gnu: Fix exit code overflow in autoconf test.
        * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Squash exit code values,
        to keep them below < 128.

--- m4/getopt.m4.orig   Tue Jun 19 12:07:32 2012
+++ m4/getopt.m4        Tue Jun 19 12:06:06 2012
@@ -1,4 +1,4 @@
-# getopt.m4 serial 39
+# getopt.m4 serial 40
 dnl Copyright (C) 2002-2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -276,7 +276,7 @@
                if (getopt (3, argv, "-p") != 1)
                  result |= 16;
                else if (getopt (3, argv, "-p") != 'p')
-                 result |= 32;
+                 result |= 16;
              }
              /* This code fails on glibc 2.11.  */
              {
@@ -286,9 +286,9 @@
                char *argv[] = { program, b, a, NULL };
                optind = opterr = 0;
                if (getopt (3, argv, "+:a:b") != 'b')
-                 result |= 64;
+                 result |= 32;
                else if (getopt (3, argv, "+:a:b") != ':')
-                 result |= 64;
+                 result |= 32;
              }
              /* This code dumps core on glibc 2.14.  */
              {
@@ -298,7 +298,7 @@
                char *argv[] = { program, w, dummy, NULL };
                optind = opterr = 1;
                if (getopt (3, argv, "W;") != 'W')
-                 result |= 128;
+                 result |= 64;
              }
              return result;
            ]])],




reply via email to

[Prev in Thread] Current Thread [Next in Thread]