From 0aad9e4395c3077ed82c58981e9495586d6c8a01 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 24 Jun 2014 08:19:24 -0500 Subject: find_in_path() is supposed to work with a NULL path, but didn't. Fix it. --- lib/lib.c | 7 +++++-- 1 file 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; -- cgit v1.2.3