aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/lib.c b/lib/lib.c
index fa0b777f..52675d56 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -194,10 +194,13 @@ struct string_list **splitpath(char *path, struct string_list **list)
struct string_list *find_in_path(char *path, char *filename)
{
struct string_list *rlist = NULL, **prlist=&rlist;
- char *cwd = xgetcwd();
+ char *cwd;
+ if (!path) return 0;
+
+ cwd = xgetcwd();
for (;;) {
- char *next = path ? strchr(path, ':') : NULL;
+ char *next = strchr(path, ':');
int len = next ? next-path : strlen(path);
struct string_list *rnext;
struct stat st;