aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-01-10 11:23:41 +0200
committerLasse Collin <lasse.collin@tukaani.org>2023-01-11 17:49:59 +0200
commit2a6b938084fac9ddb39cd69c9beeed15c3b6f6f6 (patch)
tree99960ae6c9ebeb012be502f5d9a33e7bfb5ceffa
parentxz: Fix warning -Wformat-nonliteral on clang in message.c. (diff)
downloadxz-2a6b938084fac9ddb39cd69c9beeed15c3b6f6f6.tar.xz
xz: Include <strings.h> in suffix.c if needed for strcasecmp().
SUSv2 and POSIX.1‐2017 declare only a few functions in <strings.h>. Of these, strcasecmp() is used on some platforms in suffix.c. Nothing else in the project needs <strings.h> (at least if building on a modern system). sysdefs.h currently includes <strings.h> if HAVE_STRINGS_H is defined and suffix.c relied on this. Note that dos/config.h doesn't #define HAVE_STRINGS_H even though DJGPP does have strings.h. It isn't needed with DJGPP as strcasecmp() is also in <string.h> in DJGPP.
-rw-r--r--src/xz/suffix.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/xz/suffix.c b/src/xz/suffix.c
index 6bb35d42..09add381 100644
--- a/src/xz/suffix.c
+++ b/src/xz/suffix.c
@@ -18,6 +18,9 @@
// For case-insensitive filename suffix on case-insensitive systems
#if defined(TUKLIB_DOSLIKE) || defined(__VMS)
+# ifdef HAVE_STRINGS_H
+# include <strings.h>
+# endif
# define strcmp strcasecmp
#endif