summaryrefslogtreecommitdiffstats
path: root/src/basic/path-util.h
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2024-04-22 13:07:48 +0200
committerGitHub <noreply@github.com>2024-04-22 13:07:48 +0200
commitc3411932b1b81632acd6ac8df97c9a948fbd5366 (patch)
tree2c15a3e9ee020bfe451786a1a1150bb23dbd08b1 /src/basic/path-util.h
parenttpm2-util: add generic wrapper tpm2_context_new_or_warn() that wrpas tpm2_con... (diff)
parentsd-path: rename output param (diff)
downloadsystemd-c3411932b1b81632acd6ac8df97c9a948fbd5366.tar.xz
systemd-c3411932b1b81632acd6ac8df97c9a948fbd5366.zip
Merge pull request #32389 from keszybz/bin-sbin-merge
Try PATH without sbin even if compiled with split-bin=true
Diffstat (limited to 'src/basic/path-util.h')
-rw-r--r--src/basic/path-util.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/basic/path-util.h b/src/basic/path-util.h
index 368e000121..fcb3aa9399 100644
--- a/src/basic/path-util.h
+++ b/src/basic/path-util.h
@@ -11,27 +11,26 @@
#include "strv.h"
#include "time-util.h"
-#define PATH_SPLIT_SBIN_BIN(x) x "sbin:" x "bin"
-#define PATH_SPLIT_SBIN_BIN_NULSTR(x) x "sbin\0" x "bin\0"
+#define PATH_SPLIT_BIN(x) x "sbin:" x "bin"
+#define PATH_SPLIT_BIN_NULSTR(x) x "sbin\0" x "bin\0"
-#define PATH_NORMAL_SBIN_BIN(x) x "bin"
-#define PATH_NORMAL_SBIN_BIN_NULSTR(x) x "bin\0"
+#define PATH_MERGED_BIN(x) x "bin"
+#define PATH_MERGED_BIN_NULSTR(x) x "bin\0"
-#if HAVE_SPLIT_BIN
-# define PATH_SBIN_BIN(x) PATH_SPLIT_SBIN_BIN(x)
-# define PATH_SBIN_BIN_NULSTR(x) PATH_SPLIT_SBIN_BIN_NULSTR(x)
-#else
-# define PATH_SBIN_BIN(x) PATH_NORMAL_SBIN_BIN(x)
-# define PATH_SBIN_BIN_NULSTR(x) PATH_NORMAL_SBIN_BIN_NULSTR(x)
-#endif
+#define DEFAULT_PATH_WITH_SBIN PATH_SPLIT_BIN("/usr/local/") ":" PATH_SPLIT_BIN("/usr/")
+#define DEFAULT_PATH_WITHOUT_SBIN PATH_MERGED_BIN("/usr/local/") ":" PATH_MERGED_BIN("/usr/")
+
+#define DEFAULT_PATH_COMPAT PATH_SPLIT_BIN("/usr/local/") ":" PATH_SPLIT_BIN("/usr/") ":" PATH_SPLIT_BIN("/")
-#define DEFAULT_PATH PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/")
-#define DEFAULT_PATH_NULSTR PATH_SBIN_BIN_NULSTR("/usr/local/") PATH_SBIN_BIN_NULSTR("/usr/")
-#define DEFAULT_PATH_COMPAT PATH_SPLIT_SBIN_BIN("/usr/local/") ":" PATH_SPLIT_SBIN_BIN("/usr/") ":" PATH_SPLIT_SBIN_BIN("/")
+const char* default_PATH(void);
-#ifndef DEFAULT_USER_PATH
-# define DEFAULT_USER_PATH DEFAULT_PATH
+static inline const char* default_user_PATH(void) {
+#ifdef DEFAULT_USER_PATH
+ return DEFAULT_USER_PATH;
+#else
+ return default_PATH();
#endif
+}
static inline bool is_path(const char *p) {
if (!p) /* A NULL pointer is definitely not a path */