aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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