summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorFilipe Brandenburger <filbranden@google.com>2018-04-17 22:46:03 -0700
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commit0981d331a6200bcd61f927647541bbc468631707 (patch)
treec6d0187f8b5b832a123f0ac953f61f503695535e /src/basic
parent6d5482545dd567d53e77c1d84b73a15fae7948ea (diff)
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
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/path-util.h25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/basic/path-util.h b/src/basic/path-util.h
index 8af04569b..08df54573 100644
--- a/src/basic/path-util.h
+++ b/src/basic/path-util.h
@@ -5,19 +5,6 @@
This file is part of systemd.
Copyright 2010-2012 Lennart Poettering
-
- elogind is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- elogind is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with elogind; If not, see <http://www.gnu.org/licenses/>.
***/
#include <alloca.h>
@@ -30,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_;