diff options
author | Rob Landley <rob@landley.net> | 2014-06-24 08:19:24 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-06-24 08:19:24 -0500 |
commit | 0aad9e4395c3077ed82c58981e9495586d6c8a01 (patch) | |
tree | fc3dcdce90ad6b6ff9659fa0d1aec8c73ea2eb86 /lib | |
parent | 1748bdb6bfe48cfe122973d26ab15186ee925101 (diff) | |
download | toybox-0aad9e4395c3077ed82c58981e9495586d6c8a01.tar.gz |
find_in_path() is supposed to work with a NULL path, but didn't. Fix it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; |