summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xspawn.c10
-rw-r--r--tests/xspawn.c23
2 files changed, 25 insertions, 8 deletions
diff --git a/src/xspawn.c b/src/xspawn.c
index f67adec..065fbae 100644
--- a/src/xspawn.c
+++ b/src/xspawn.c
@@ -364,16 +364,10 @@ static int bfs_resolve_late(struct bfs_resolver *res) {
res->done = true;
return 0;
}
-
- if (end) {
- path = end + 1;
- } else {
- errno = ENOENT;
- return -1;
- }
}
- return 0;
+ errno = ENOENT;
+ return -1;
}
/** Check if we can skip path resolution entirely. */
diff --git a/tests/xspawn.c b/tests/xspawn.c
index 5f80e76..c1bac36 100644
--- a/tests/xspawn.c
+++ b/tests/xspawn.c
@@ -170,6 +170,27 @@ out:
return ret;
}
+static bool check_resolve(void) {
+ bool ret = true;
+ char *exe;
+
+ exe = bfs_spawn_resolve("sh");
+ ret &= bfs_pcheck(exe, "bfs_spawn_resolve('sh')");
+ free(exe);
+
+ exe = bfs_spawn_resolve("/bin/sh");
+ ret &= bfs_pcheck(exe && strcmp(exe, "/bin/sh") == 0);
+ free(exe);
+
+ exe = bfs_spawn_resolve("bin/tests/xspawnee");
+ ret &= bfs_pcheck(exe && strcmp(exe, "bin/tests/xspawnee") == 0);
+ free(exe);
+
+ ret &= bfs_pcheck(!bfs_spawn_resolve("eW6f5RM9Qi") && errno == ENOENT);
+
+ return ret;
+}
+
bool check_xspawn(void) {
bool ret = true;
@@ -179,5 +200,7 @@ bool check_xspawn(void) {
ret &= check_enoent(true);
ret &= check_enoent(false);
+ ret &= check_resolve();
+
return ret;
}