diff options
author | Matt Johnston <matt@ucc.asn.au> | 2013-03-19 20:04:55 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2013-03-19 20:04:55 +0800 |
commit | 6270ed2f8a0b6ce13bb244766e4fd9e46ae5002b (patch) | |
tree | d04e6447d7139f83c4c89280e748fca31a8e86e9 /compat.c | |
parent | 80e77b5e6d1ca8487baa1d80068b654b73443cd8 (diff) |
Fix compat basename() to handle paths with no slashes. Thanks to Frank Teo
Diffstat (limited to 'compat.c')
-rw-r--r-- | compat.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -193,6 +193,10 @@ int daemon(int nochdir, int noclose) { char *basename(const char *path) { char *foo = strrchr(path, '/'); + if (!foo) + { + return path; + } return ++foo; } |