find: estrdup before basename
"The basename() function may modify the string pointed to by path..." Thanks POSIX Laslo: Changed the style a bit
This commit is contained in:
parent
b7c73e2392
commit
0b27c0c9a0
9
find.c
9
find.c
|
@ -229,7 +229,14 @@ static struct {
|
||||||
static int
|
static int
|
||||||
pri_name(struct arg *arg)
|
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
|
static int
|
||||||
|
|
Loading…
Reference in New Issue
Block a user