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 | 16b664c9a608972ec4b7eb8f25b8afd90f909cf6 (patch) | |
tree | a5c21552eb7dc72627aaa7306577d104fe7db949 /compat.c | |
parent | fbb5901bf14d48d341c9b927603ecd4b1cd412fe (diff) | |
download | dropbear-16b664c9a608972ec4b7eb8f25b8afd90f909cf6.tar.gz |
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; } |