Fix compat basename() to handle paths with no slashes. Thanks to Frank Teo

This commit is contained in:
Matt Johnston 2013-03-19 20:04:55 +08:00
parent 80e77b5e6d
commit 6270ed2f8a

View File

@ -193,6 +193,10 @@ int daemon(int nochdir, int noclose) {
char *basename(const char *path) { char *basename(const char *path) {
char *foo = strrchr(path, '/'); char *foo = strrchr(path, '/');
if (!foo)
{
return path;
}
return ++foo; return ++foo;
} }