diff compat.c @ 703:caa09587c3fb

Fix compat basename() to handle paths with no slashes. Thanks to Frank Teo
author Matt Johnston <matt@ucc.asn.au>
date Tue, 19 Mar 2013 20:04:55 +0800
parents ace512d2ad5d
children a0062a354a80
line wrap: on
line diff
--- 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;
 }