summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/which/which-2.21/0001-getopt-Fix-signature-of-getenv-function.patch
blob: e006d797d3c4eb412ba0c9f87c73027bf9431afe (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
From 16a1647fc26953fab659de5f55d4c0defdfb894f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 22 Mar 2025 17:56:19 -0700
Subject: [PATCH] getopt: Fix signature of getenv function

This happens on musl systems using GCC 15

../which-2.21/getopt.h:106:12: error: conflicting types for 'getopt'; have 'int(void)'
  106 | extern int getopt ();
      |            ^~~~~~

Upstream-Status: Submitted [https://lists.gnu.org/archive/html/which-bugs/2025-03/msg00000.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 getopt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/getopt.c
+++ b/getopt.c
@@ -209,7 +209,7 @@ static char *posixly_correct;
 /* Avoid depending on library functions or files
    whose names are inconsistent.  */
 
-char *getenv ();
+char *getenv (const char*);
 
 static char *
 my_index (str, chr)
--- a/getopt.h
+++ b/getopt.h
@@ -103,7 +103,7 @@ struct option
    errors, only prototype getopt for the GNU C library.  */
 extern int getopt (int argc, char *const *argv, const char *shortopts);
 #else /* not __GNU_LIBRARY__ */
-extern int getopt ();
+extern int getopt (int, char * const [], const char *);
 #endif /* __GNU_LIBRARY__ */
 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
 		        const struct option *longopts, int *longind);