sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 0b27c0c9a08ac4fd23a8753f2a3ba8672cd94497
parent b7c73e23929ca0aa68f48daf9f405fff7cce9fe7
Author: Evan Gates <evan.gates@gmail.com>
Date:   Wed,  5 Oct 2016 15:37:34 -0700

find: estrdup before basename

"The basename() function may modify the string pointed to by path..."
Thanks POSIX

Laslo: Changed the style a bit

Diffstat:
Mfind.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/find.c b/find.c @@ -229,7 +229,14 @@ static struct { 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