mirror of
https://github.com/systemd/systemd.git
synced 2025-03-23 10:50:16 +03:00
path-util: Finish DEFAULT_PATH_NULSTR with an extra NUL (#8745)
The NULSTR_FOREACH iterator needs to see an empty string at the end, so we need to insert an extra NUL explicitly. Also update PATH0_BIN_SBIN(x) to include an extra NUL terminator, rename it to PATH_BIN_SBIN_NULSTR(x), which is more consistent with the similar CONF_PATHS_NULSTR(x) macro. Fixes: 5008da1ec1cf2cf8c15b702c4052e3a49583095d
This commit is contained in:
parent
0630eb1bcc
commit
2259e8fbbc
@ -17,23 +17,23 @@
|
||||
|
||||
#if HAVE_SPLIT_BIN
|
||||
# define PATH_SBIN_BIN(x) x "sbin:" x "bin"
|
||||
# define PATH0_SBIN_BIN(x) x "sbin\0" x "bin"
|
||||
# define PATH_SBIN_BIN_NULSTR(x) x "sbin\0" x "bin\0"
|
||||
#else
|
||||
# define PATH0_SBIN_BIN(x) x "bin"
|
||||
# define PATH_SBIN_BIN(x) x "bin"
|
||||
# define PATH_SBIN_BIN_NULSTR(x) x "bin\0"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_PATH_NORMAL PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/")
|
||||
#define DEFAULT_PATH0_NORMAL PATH0_SBIN_BIN("/usr/local/") "\0" PATH0_SBIN_BIN("/usr/")
|
||||
#define DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/usr/local/") PATH_SBIN_BIN_NULSTR("/usr/")
|
||||
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_SBIN_BIN("/")
|
||||
#define DEFAULT_PATH0_SPLIT_USR DEFAULT_PATH0_NORMAL "\0" PATH0_SBIN_BIN("/")
|
||||
#define DEFAULT_PATH_SPLIT_USR_NULSTR DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/")
|
||||
|
||||
#if HAVE_SPLIT_USR
|
||||
# define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
|
||||
# define DEFAULT_PATH_NULSTR DEFAULT_PATH0_SPLIT_USR
|
||||
# define DEFAULT_PATH_NULSTR DEFAULT_PATH_SPLIT_USR_NULSTR
|
||||
#else
|
||||
# define DEFAULT_PATH DEFAULT_PATH_NORMAL
|
||||
# define DEFAULT_PATH_NULSTR DEFAULT_PATH0_NORMAL
|
||||
# define DEFAULT_PATH_NULSTR DEFAULT_PATH_NORMAL_NULSTR
|
||||
#endif
|
||||
|
||||
bool is_path(const char *p) _pure_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user