From: Karel Zak Date: Tue, 2 Jul 2024 08:39:12 +0000 (+0200) Subject: build-sys: _PATH_VENDORDIR workaround X-Git-Tag: v2.40.2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10d3bb70d2f754cb5c86063c0115cfa0d9575bb7;p=thirdparty%2Futil-linux.git build-sys: _PATH_VENDORDIR workaround It appears that certain versions of libeconf do not handle calls to econf_readDirs() with NULL path. Therefore, let's set the default to "/usr/etc" if no value is defined by using the "--with-vendordir=" option. Addresses: https://github.com/util-linux/util-linux/issues/3091 Signed-off-by: Karel Zak --- diff --git a/include/pathnames.h b/include/pathnames.h index 81fa405f6..de456c53e 100644 --- a/include/pathnames.h +++ b/include/pathnames.h @@ -233,4 +233,9 @@ /* Maximum number of PIDs system supports */ #define _PATH_PROC_PIDMAX "/proc/sys/kernel/pid_max" +/* libeconf default */ +#ifndef _PATH_VENDORDIR +# define _PATH_VENDORDIR "/usr/etc" +#endif + #endif /* PATHNAMES_H */ diff --git a/lib/logindefs.c b/lib/logindefs.c index 95631223a..b51e65fdf 100644 --- a/lib/logindefs.c +++ b/lib/logindefs.c @@ -255,11 +255,7 @@ static void load_defaults(void) free_getlogindefs_data(); error = econf_readDirs(&file, -#if USE_VENDORDIR _PATH_VENDORDIR, -#else - NULL, -#endif "/etc", "login", "defs", "= \t", "#"); if (error) diff --git a/libblkid/src/config.c b/libblkid/src/config.c index 66c1864f0..19c80ea9d 100644 --- a/libblkid/src/config.c +++ b/libblkid/src/config.c @@ -28,6 +28,7 @@ #include "blkidP.h" #include "env.h" +#include "pathnames.h" static int parse_evaluate(struct blkid_config *conf, char *s) { @@ -162,11 +163,7 @@ struct blkid_config *blkid_read_config(const char *filename) error = econf_readFile(&file, filename, "= \t", "#"); } else { error = econf_readDirs(&file, -#if USE_VENDORDIR _PATH_VENDORDIR, -#else - NULL, -#endif "/etc", "blkid", "conf", "= \t", "#"); } diff --git a/meson.build b/meson.build index a5df66d20..e3a2780ad 100644 --- a/meson.build +++ b/meson.build @@ -79,7 +79,9 @@ conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir) conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime') conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :( -conf.set_quoted('_PATH_VENDORDIR', vendordir) +if vendordir != '' + conf.set_quoted('_PATH_VENDORDIR', vendordir) +endif conf.set('USE_VENDORDIR', vendordir == '' ? false : 1) build_libblkid = get_option('build-libblkid').allowed()