aboutsummaryrefslogtreecommitdiffstats
path: root/src/unistd
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-20 19:26:36 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-20 19:26:36 +0100
commit456fb08bb9072aea79b98c19f455df80ed1ef9e8 (patch)
treefbc569397dfa1e039ceea2a83b3aa4c6f7aa9ee9 /src/unistd
parentfuture directions (diff)
downloadslibc-456fb08bb9072aea79b98c19f455df80ed1ef9e8.tar.gz
slibc-456fb08bb9072aea79b98c19f455df80ed1ef9e8.tar.bz2
slibc-456fb08bb9072aea79b98c19f455df80ed1ef9e8.tar.xz
compile-time configurable default value for path
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r--src/unistd/searchpath3.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/unistd/searchpath3.c b/src/unistd/searchpath3.c
index 5fabc62..4ab49fe 100644
--- a/src/unistd/searchpath3.c
+++ b/src/unistd/searchpath3.c
@@ -25,6 +25,15 @@
/**
+ * The default value for the PATH environment variable.
+ */
+#ifndef DEFAULT_PATH
+# define DEFAULT_PATH "/usr/local/bin:/bin:/usr/bin"
+#endif
+
+
+
+/**
* Search the environment variable $PATH for an executable
* file whose name is the specified name. Slashes are ignored
* and treated as any other character. $PATH is searched
@@ -95,10 +104,10 @@ char* searchpath3(const char* name, const char* fallback, const char* first)
}
if (path == NULL)
{
- path = malloc(strlen(first) * sizeof(char) + sizeof(":/usr/local/bin:/bin:/usr/bin"));
+ path = malloc(strlen(first) * sizeof(char) + sizeof(":" DEFAULT_PATH));
if (path == NULL)
goto fail;
- stpcpy(stpcpy(path, first), ":/usr/local/bin:/bin:/usr/bin");
+ stpcpy(stpcpy(path, first), ":" DEFAULT_PATH);
}
}
else