From d1affffac17e541a39efab2e61e9ab674db37270 Mon Sep 17 00:00:00 2001 From: Dongkyun Son Date: Tue, 21 May 2024 19:39:25 +0900 Subject: [PATCH] The build framework of zip adds -DNO_DIR to CFLAGS after failing to link this piece of test code: MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit int main() { return closedir(opendir(".")); } However, zip does not take a case into account when it does not need to link to an extra library for these functions. When -DNO_DIR is used, the code in unix.c defines custom opendir()/readdir()/closedir() functions in a way that GCC 14 chokes on. GLIBC has both and and apps don't need any extra library to link with. Add a patch to remove the definition of NO_DIR. Instead, use -DHAVE_DIRENT_H in the recipe. Remove 0002-unix.c-Do-not-redefine-DIR-as-FILE.patch which is now unnecessary. This fixes the compiler error observed with GCC 14. Change-Id: I6695873024d64bf610562e615cdcf42fa953b7ff Signed-off-by: Zoltán Böszörményi --- unix/configure | 3 --- unix/unix.c | 1 - 2 files changed, 4 deletions(-) diff --git a/unix/configure b/unix/configure index 38974c5..d094275 100755 --- a/unix/configure +++ b/unix/configure @@ -2373,9 +2373,6 @@ else if [ ${OPT} ]; then echo " Found: ${OPT}" LFLAGS="${LFLAGS2} ${OPT}" - else - echo ' Found none (NO_DIR).' - CFLAGS_TST="${CFLAGS_TST} -DNO_DIR" fi fi diff --git a/unix/unix.c b/unix/unix.c index bc6dad4..95ea10e 100644 --- a/unix/unix.c +++ b/unix/unix.c @@ -149,7 +149,6 @@ static ZCONST char CannotSetTimestamps[] = #define opendir(path) fopen(path,"r") #define closedir(dir) fclose(dir) -typedef FILE DIR; typedef struct zdir { FILE *dirhandle; struct dirent *entry; -- 2.7.4