From 96f76577d3ae58c10102987c26707c1d6a7e783b Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sat, 13 Sep 2025 12:30:03 -0700 Subject: [PATCH] Rename err.h to avoid conflict with system header Depending on header search path ordering, we can easily confuse libarchive_fe/err.h with the system header. Rename ours to lafe_err.h to avoid the confusion. Rename libarchive_fe/err.c to match. --- Makefile.am | 4 ++-- cat/CMakeLists.txt | 4 ++-- cat/bsdcat.c | 2 +- cat/cmdline.c | 2 +- contrib/android/Android.mk | 2 +- cpio/CMakeLists.txt | 4 ++-- cpio/cmdline.c | 2 +- cpio/cpio.c | 2 +- cpio/cpio_windows.c | 2 +- cpio/test/CMakeLists.txt | 2 +- cpio/test/test_owner_parse.c | 2 +- libarchive_fe/{err.c => lafe_err.c} | 2 +- libarchive_fe/{err.h => lafe_err.h} | 0 libarchive_fe/line_reader.c | 2 +- libarchive_fe/passphrase.c | 2 +- tar/CMakeLists.txt | 4 ++-- tar/bsdtar.c | 2 +- tar/bsdtar_windows.c | 2 +- tar/cmdline.c | 2 +- tar/creation_set.c | 2 +- tar/read.c | 2 +- tar/subst.c | 2 +- tar/util.c | 2 +- tar/write.c | 2 +- unzip/CMakeLists.txt | 4 ++-- unzip/bsdunzip.c | 2 +- unzip/cmdline.c | 2 +- unzip/test/CMakeLists.txt | 2 +- 28 files changed, 32 insertions(+), 32 deletions(-) rename libarchive_fe/{err.c => lafe_err.c} (99%) rename libarchive_fe/{err.h => lafe_err.h} (100%) diff --git a/Makefile.am b/Makefile.am index 735a44ab9..b99c4afbb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1074,8 +1074,8 @@ libarchive_test_EXTRA_DIST=\ # Common code for libarchive frontends (cpio, tar) # libarchive_fe_la_SOURCES= \ - libarchive_fe/err.c \ - libarchive_fe/err.h \ + libarchive_fe/lafe_err.c \ + libarchive_fe/lafe_err.h \ libarchive_fe/lafe_platform.h \ libarchive_fe/line_reader.c \ libarchive_fe/line_reader.h \ diff --git a/cat/CMakeLists.txt b/cat/CMakeLists.txt index d534980b9..2bf132f78 100644 --- a/cat/CMakeLists.txt +++ b/cat/CMakeLists.txt @@ -13,8 +13,8 @@ IF(ENABLE_CAT) bsdcat.h bsdcat_platform.h cmdline.c - ../libarchive_fe/err.c - ../libarchive_fe/err.h + ../libarchive_fe/lafe_err.c + ../libarchive_fe/lafe_err.h ../libarchive_fe/lafe_platform.h ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) diff --git a/cat/bsdcat.c b/cat/bsdcat.c index 40fdd0436..2e78870ae 100644 --- a/cat/bsdcat.c +++ b/cat/bsdcat.c @@ -25,7 +25,7 @@ #include #include "bsdcat.h" -#include "err.h" +#include "lafe_err.h" #define BYTES_PER_BLOCK (20*512) diff --git a/cat/cmdline.c b/cat/cmdline.c index 8ecd74aa9..5a5fcaf02 100644 --- a/cat/cmdline.c +++ b/cat/cmdline.c @@ -22,7 +22,7 @@ #endif #include "bsdcat.h" -#include "err.h" +#include "lafe_err.h" /* * Short options for bsdcat. Please keep this sorted. diff --git a/contrib/android/Android.mk b/contrib/android/Android.mk index 8e7fbdace..2e9d9a399 100644 --- a/contrib/android/Android.mk +++ b/contrib/android/Android.mk @@ -151,7 +151,7 @@ else libarchive_host_src_files := endif -libarchive_fe_src_files := libarchive_fe/err.c \ +libarchive_fe_src_files := libarchive_fe/lafe_err.c \ libarchive_fe/line_reader.c \ libarchive_fe/passphrase.c diff --git a/cpio/CMakeLists.txt b/cpio/CMakeLists.txt index 2fee053bd..7678ed658 100644 --- a/cpio/CMakeLists.txt +++ b/cpio/CMakeLists.txt @@ -13,8 +13,8 @@ IF(ENABLE_CPIO) cpio.c cpio.h cpio_platform.h - ../libarchive_fe/err.c - ../libarchive_fe/err.h + ../libarchive_fe/lafe_err.c + ../libarchive_fe/lafe_err.h ../libarchive_fe/lafe_platform.h ../libarchive_fe/line_reader.c ../libarchive_fe/line_reader.h diff --git a/cpio/cmdline.c b/cpio/cmdline.c index c67519947..db06c03c0 100644 --- a/cpio/cmdline.c +++ b/cpio/cmdline.c @@ -26,7 +26,7 @@ #endif #include "cpio.h" -#include "err.h" +#include "lafe_err.h" /* * Short options for cpio. Please keep this sorted. diff --git a/cpio/cpio.c b/cpio/cpio.c index cd88d416e..262db5105 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -60,7 +60,7 @@ #endif #include "cpio.h" -#include "err.h" +#include "lafe_err.h" #include "line_reader.h" #include "passphrase.h" diff --git a/cpio/cpio_windows.c b/cpio/cpio_windows.c index 267b37975..144814186 100644 --- a/cpio/cpio_windows.c +++ b/cpio/cpio_windows.c @@ -24,7 +24,7 @@ #include #include "cpio.h" -#include "err.h" +#include "lafe_err.h" #define EPOC_TIME (116444736000000000ULL) diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt index 2c530661c..fe6ab968d 100644 --- a/cpio/test/CMakeLists.txt +++ b/cpio/test/CMakeLists.txt @@ -9,7 +9,7 @@ IF(ENABLE_CPIO AND ENABLE_TEST) SET(bsdcpio_test_SOURCES ../cmdline.c - ../../libarchive_fe/err.c + ../../libarchive_fe/lafe_err.c ../../test_utils/test_utils.c ../../test_utils/test_main.c test.h diff --git a/cpio/test/test_owner_parse.c b/cpio/test/test_owner_parse.c index dfc78ca77..bd68f21ce 100644 --- a/cpio/test/test_owner_parse.c +++ b/cpio/test/test_owner_parse.c @@ -7,7 +7,7 @@ #include "test.h" #include "../cpio.h" -#include "err.h" +#include "lafe_err.h" #if !defined(_WIN32) #define ROOT "root" diff --git a/libarchive_fe/err.c b/libarchive_fe/lafe_err.c similarity index 99% rename from libarchive_fe/err.c rename to libarchive_fe/lafe_err.c index f6dcf44af..b108b9b1f 100644 --- a/libarchive_fe/err.c +++ b/libarchive_fe/lafe_err.c @@ -36,7 +36,7 @@ #include #endif -#include "err.h" +#include "lafe_err.h" static void lafe_vwarnc(int, const char *, va_list) __LA_PRINTFLIKE(2, 0); diff --git a/libarchive_fe/err.h b/libarchive_fe/lafe_err.h similarity index 100% rename from libarchive_fe/err.h rename to libarchive_fe/lafe_err.h diff --git a/libarchive_fe/line_reader.c b/libarchive_fe/line_reader.c index 7f0429ece..0af9db53c 100644 --- a/libarchive_fe/line_reader.c +++ b/libarchive_fe/line_reader.c @@ -31,7 +31,7 @@ #include #include -#include "err.h" +#include "lafe_err.h" #include "line_reader.h" #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) diff --git a/libarchive_fe/passphrase.c b/libarchive_fe/passphrase.c index 527ad2d63..1b7a50453 100644 --- a/libarchive_fe/passphrase.c +++ b/libarchive_fe/passphrase.c @@ -61,7 +61,7 @@ #include #endif -#include "err.h" +#include "lafe_err.h" #include "passphrase.h" #ifndef HAVE_READPASSPHRASE diff --git a/tar/CMakeLists.txt b/tar/CMakeLists.txt index b09426945..c082c66e4 100644 --- a/tar/CMakeLists.txt +++ b/tar/CMakeLists.txt @@ -18,8 +18,8 @@ IF(ENABLE_TAR) subst.c util.c write.c - ../libarchive_fe/err.c - ../libarchive_fe/err.h + ../libarchive_fe/lafe_err.c + ../libarchive_fe/lafe_err.h ../libarchive_fe/lafe_platform.h ../libarchive_fe/line_reader.c ../libarchive_fe/line_reader.h diff --git a/tar/bsdtar.c b/tar/bsdtar.c index c80c1a1b6..92e86fd6b 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -55,7 +55,7 @@ #endif #include "bsdtar.h" -#include "err.h" +#include "lafe_err.h" #if ARCHIVE_VERSION_NUMBER < 4000000 && !defined(_PATH_DEFTAPE) // Libarchive 4.0 and later will NOT define _PATH_DEFTAPE diff --git a/tar/bsdtar_windows.c b/tar/bsdtar_windows.c index a63f27e50..da49b4363 100644 --- a/tar/bsdtar_windows.c +++ b/tar/bsdtar_windows.c @@ -24,7 +24,7 @@ #include #include "bsdtar.h" -#include "err.h" +#include "lafe_err.h" /* This may actually not be needed anymore. * TODO: Review the error handling for chdir() failures and diff --git a/tar/cmdline.c b/tar/cmdline.c index c766c1a52..309be312c 100644 --- a/tar/cmdline.c +++ b/tar/cmdline.c @@ -22,7 +22,7 @@ #endif #include "bsdtar.h" -#include "err.h" +#include "lafe_err.h" /* * Short options for tar. Please keep this sorted. diff --git a/tar/creation_set.c b/tar/creation_set.c index 688309041..51f803354 100644 --- a/tar/creation_set.c +++ b/tar/creation_set.c @@ -15,7 +15,7 @@ #endif #include "bsdtar.h" -#include "err.h" +#include "lafe_err.h" struct creation_set { char *create_format; diff --git a/tar/read.c b/tar/read.c index 8563fe714..7cbcfb19f 100644 --- a/tar/read.c +++ b/tar/read.c @@ -57,7 +57,7 @@ #endif #include "bsdtar.h" -#include "err.h" +#include "lafe_err.h" struct progress_data { struct bsdtar *bsdtar; diff --git a/tar/subst.c b/tar/subst.c index 5546b5f93..a5d644dc5 100644 --- a/tar/subst.c +++ b/tar/subst.c @@ -25,7 +25,7 @@ #define REG_BASIC 0 #endif -#include "err.h" +#include "lafe_err.h" struct subst_rule { struct subst_rule *next; diff --git a/tar/util.c b/tar/util.c index 5bad4345e..fc5e15cb0 100644 --- a/tar/util.c +++ b/tar/util.c @@ -41,7 +41,7 @@ #endif #include "bsdtar.h" -#include "err.h" +#include "lafe_err.h" #include "passphrase.h" static size_t bsdtar_expand_char(char *, size_t, size_t, char); diff --git a/tar/write.c b/tar/write.c index 92cc0ce57..9e6c97b58 100644 --- a/tar/write.c +++ b/tar/write.c @@ -58,7 +58,7 @@ #endif #include "bsdtar.h" -#include "err.h" +#include "lafe_err.h" #include "line_reader.h" #ifndef O_BINARY diff --git a/unzip/CMakeLists.txt b/unzip/CMakeLists.txt index 586245b67..f3c62cb33 100644 --- a/unzip/CMakeLists.txt +++ b/unzip/CMakeLists.txt @@ -16,8 +16,8 @@ IF(ENABLE_UNZIP) la_getline.c la_getline.h la_queue.h - ../libarchive_fe/err.c - ../libarchive_fe/err.h + ../libarchive_fe/lafe_err.c + ../libarchive_fe/lafe_err.h ../libarchive_fe/lafe_platform.h ../libarchive_fe/passphrase.c ../libarchive_fe/passphrase.h diff --git a/unzip/bsdunzip.c b/unzip/bsdunzip.c index 0559a0ddc..1b520e841 100644 --- a/unzip/bsdunzip.c +++ b/unzip/bsdunzip.c @@ -57,7 +57,7 @@ #include "bsdunzip.h" #include "passphrase.h" -#include "err.h" +#include "lafe_err.h" /* command-line options */ static int a_opt; /* convert EOL */ diff --git a/unzip/cmdline.c b/unzip/cmdline.c index 8afddedd5..8e6eedd23 100644 --- a/unzip/cmdline.c +++ b/unzip/cmdline.c @@ -21,7 +21,7 @@ #endif #include "bsdunzip.h" -#include "err.h" +#include "lafe_err.h" /* * Short options for bsdunzip. Please keep this sorted. diff --git a/unzip/test/CMakeLists.txt b/unzip/test/CMakeLists.txt index 789cfb7e4..57ed651a5 100644 --- a/unzip/test/CMakeLists.txt +++ b/unzip/test/CMakeLists.txt @@ -5,7 +5,7 @@ ############################################ IF(ENABLE_UNZIP AND ENABLE_TEST) SET(bsdunzip_test_SOURCES - ../../libarchive_fe/err.c + ../../libarchive_fe/lafe_err.c ../../test_utils/test_utils.c ../../test_utils/test_main.c test.h -- 2.47.3