summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/diffutils-getopt.patch
blob: 05c2504adfbf9e913a7585695f8e1710724fedf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
commit e3461d1c21a99bcef1b8826f710434e0ffb5adea
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Sun Jun 11 15:53:09 2017 -0700

    getopt-posix: port to glibc 2.25.90
    
    Problem reported by Daniel P. Berrange in:
    http://lists.gnu.org/archive/html/bug-gnulib/2017-06/msg00003.html
    * lib/getopt-pfx-core.h (_GETOPT_CORE_H):
    * lib/getopt-pfx-ext.h (_GETOPT_EXT_H):
    #undef if __GETOPT_PREFIX is defined.

diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h
index 155c11612..6ad0da683 100644
--- a/lib/getopt-pfx-core.h
+++ b/lib/getopt-pfx-core.h
@@ -47,6 +47,11 @@
 # define opterr __GETOPT_ID (opterr)
 # define optind __GETOPT_ID (optind)
 # define optopt __GETOPT_ID (optopt)
+
+/* The system's getopt.h may have already included getopt-core.h to
+   declare the unprefixed identifiers.  Undef _GETOPT_CORE_H so that
+   getopt-core.h declares them with prefixes.  */
+# undef _GETOPT_CORE_H
 #endif
 
 #include <getopt-core.h>
diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h
index d960bb34e..c5ac52202 100644
--- a/lib/getopt-pfx-ext.h
+++ b/lib/getopt-pfx-ext.h
@@ -45,6 +45,11 @@
 # define getopt_long_only __GETOPT_ID (getopt_long_only)
 # define option __GETOPT_ID (option)
 # define _getopt_internal __GETOPT_ID (getopt_internal)
+
+/* The system's getopt.h may have already included getopt-ext.h to
+   declare the unprefixed identifiers.  Undef _GETOPT_EXT_H so that
+   getopt-ext.h declares them with prefixes.  */
+# undef _GETOPT_EXT_H
 #endif
 
 /* Standalone applications get correct prototypes for getopt_long and