# HG changeset patch # User Matt Johnston # Date 1363694695 -28800 # Node ID caa09587c3fb46541e1febf191bc20e5e440ae1f # Parent 48e173a0c52b49aab58328c471ed8f74cd6525fb Fix compat basename() to handle paths with no slashes. Thanks to Frank Teo diff -r 48e173a0c52b -r caa09587c3fb compat.c --- a/compat.c Tue Mar 19 19:47:29 2013 +0800 +++ b/compat.c Tue Mar 19 20:04:55 2013 +0800 @@ -193,6 +193,10 @@ char *basename(const char *path) { char *foo = strrchr(path, '/'); + if (!foo) + { + return path; + } return ++foo; }