find: estrdup before basename
"The basename() function may modify the string pointed to by path..."
Thanks POSIX
Laslo: Changed the style a bit
diff --git a/find.c b/find.c
index 5f75735..fb6f21e 100644
--- a/find.c
+++ b/find.c
@@ -229,7 +229,14 @@
static int
pri_name(struct arg *arg)
{
- return !fnmatch((char *)arg->extra.p, basename(arg->path), 0);
+ int ret;
+ char *path;
+
+ path = estrdup(arg->path);
+ ret = !fnmatch((char *)arg->extra.p, basename(path), 0);
+ free(path);
+
+ return ret;
}
static int