From 43a4c1fb04198fbbe485d55de4a1056d3ec23d2d Mon Sep 17 00:00:00 2001 From: Ed Schouten 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 --- libutil/pw_util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libutil') diff --git a/libutil/pw_util.c b/libutil/pw_util.c index af749d5..2838871 100644 --- a/libutil/pw_util.c +++ b/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.2.3-56-ge451