| From 6787914efad562e4097a153988109c5c7158abf7 Mon Sep 17 00:00:00 2001 |
| From: Baruch Siach <baruch@tkos.co.il> |
| Date: Wed, 16 Aug 2017 13:35:57 +0300 |
| Subject: [PATCH] getopt: fix strncmp() declaration |
| |
| The strncmp() declaration does not conform with the standard as to the |
| type of the 'n' parameter. Fix this to avoid the following build failure |
| with musl libc: |
| |
| n file included from main.c:61:0: |
| getopt.c:175:13: error: conflicting types for 'strncmp' |
| extern int strncmp(const char *s1, const char *s2, unsigned int n); |
| ^~~~~~~ |
| In file included from main.c:49:0: |
| .../host/x86_64-buildroot-linux-musl/sysroot/usr/include/string.h:38:5: note: previous declaration of 'strncmp' was here |
| int strncmp (const char *, const char *, size_t); |
| ^~~~~~~ |
| Signed-off-by: Baruch Siach <baruch@tkos.co.il> |
| --- |
| Upstream status: https://sourceforge.net/p/faac/bugs/217/ |
| |
| frontend/getopt.c | 2 +- |
| 1 file changed, 1 insertion(+), 1 deletion(-) |
| |
| diff --git a/frontend/getopt.c b/frontend/getopt.c |
| index 185d49b804dd..40c7a2242551 100644 |
| --- a/frontend/getopt.c |
| +++ b/frontend/getopt.c |
| @@ -172,7 +172,7 @@ static enum |
| #if __STDC__ || defined(PROTO) |
| extern char *getenv(const char *name); |
| extern int strcmp (const char *s1, const char *s2); |
| -extern int strncmp(const char *s1, const char *s2, unsigned int n); |
| +extern int strncmp(const char *s1, const char *s2, size_t n); |
| |
| static int my_strlen(const char *s); |
| static char *my_index (const char *str, int chr); |
| -- |
| 2.14.1 |
| |