summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util.h4
-rw-r--r--src/xspawn.c12
2 files changed, 14 insertions, 2 deletions
diff --git a/src/util.h b/src/util.h
index 2e89af6..ac08e4d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -58,6 +58,10 @@
# define BFS_HAS_MNTENT BFS_HAS_INCLUDE(<mntent.h>, __GLIBC__)
#endif
+#ifndef BFS_HAS_PATHS
+# define BFS_HAS_PATHS BFS_HAS_INCLUDE(<paths.h>, true)
+#endif
+
#ifndef BFS_HAS_SYS_ACL
# define BFS_HAS_SYS_ACL BFS_HAS_INCLUDE(<sys/acl.h>, true)
#endif
diff --git a/src/xspawn.c b/src/xspawn.c
index 67e0572..43a6f1c 100644
--- a/src/xspawn.c
+++ b/src/xspawn.c
@@ -24,6 +24,10 @@
#include <sys/wait.h>
#include <unistd.h>
+#if BFS_HAS_PATHS
+# include <paths.h>
+#endif
+
/**
* Types of spawn actions.
*/
@@ -260,11 +264,15 @@ char *bfs_spawn_resolve(const char *exe) {
const char *path = getenv("PATH");
char *confpath = NULL;
-#ifdef _CS_PATH
if (!path) {
+#if defined(_CS_PATH)
path = confpath = xconfstr(_CS_PATH);
- }
+#elif defined(_PATH_DEFPATH)
+ path = _PATH_DEFPATH;
+#else
+ errno = ENOENT;
#endif
+ }
if (!path) {
return NULL;
}