From 29410b4082844f1db01761aa2c06a05ea49034fc Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 1 May 2016 08:22:11 +0000 Subject: Remove useless calls to basename(). There are a couple of places in the source three where we call basename() on constant strings. This is bad, because the prototype standardized by POSIX allows the implementation to use its argument as a storage buffer. This change eliminates some of these unportable calls to basename() in cases where it was only added for cosmetical reasons, namely to trim argv[0]. There's nothing wrong with setting argv[0] to the full path. Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D6093 --- lib/libutil/pw_util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/libutil/pw_util.c') diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c index af749d5..2838871 100644 --- a/lib/libutil/pw_util.c +++ b/lib/libutil/pw_util.c @@ -58,7 +58,6 @@ static const char rcsid[] = #include #include #include -#include #include #include #include @@ -315,7 +314,7 @@ pw_edit(int notsetuid) (void)setuid(getuid()); } errno = 0; - execlp(editor, basename(editor), tempname, (char *)NULL); + execlp(editor, editor, tempname, (char *)NULL); _exit(errno); default: /* parent */ -- cgit v1.1