1From 16a1647fc26953fab659de5f55d4c0defdfb894f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 22 Mar 2025 17:56:19 -0700
4Subject: [PATCH] getopt: Fix signature of getenv function
5
6This happens on musl systems using GCC 15
7
8../which-2.21/getopt.h:106:12: error: conflicting types for 'getopt'; have 'int(void)'
9  106 | extern int getopt ();
10      |            ^~~~~~
11
12Upstream-Status: Submitted [https://lists.gnu.org/archive/html/which-bugs/2025-03/msg00000.html]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 getopt.c | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18--- a/getopt.c
19+++ b/getopt.c
20@@ -209,7 +209,7 @@ static char *posixly_correct;
21 /* Avoid depending on library functions or files
22    whose names are inconsistent.  */
23
24-char *getenv ();
25+char *getenv (const char*);
26
27 static char *
28 my_index (str, chr)
29--- a/getopt.h
30+++ b/getopt.h
31@@ -103,7 +103,7 @@ struct option
32    errors, only prototype getopt for the GNU C library.  */
33 extern int getopt (int argc, char *const *argv, const char *shortopts);
34 #else /* not __GNU_LIBRARY__ */
35-extern int getopt ();
36+extern int getopt (int, char * const [], const char *);
37 #endif /* __GNU_LIBRARY__ */
38 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
39 		        const struct option *longopts, int *longind);
40