aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil/pw_util.c
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2016-05-01 08:22:11 +0000
committerEd Schouten <ed@FreeBSD.org>2016-05-01 08:22:11 +0000
commite33d251e8e9949ef6cea8d7832e9171cbd814dd4 (patch)
tree3099b026b5642c95eb4110f7a0cc0b1c07db9061 /lib/libutil/pw_util.c
parent82f860283c8d4abe08a34dbfac75eaebd0633091 (diff)
downloadsrc-e33d251e8e9949ef6cea8d7832e9171cbd814dd4.tar.gz
src-e33d251e8e9949ef6cea8d7832e9171cbd814dd4.zip
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
Notes
Notes: svn path=/head/; revision=298876
Diffstat (limited to 'lib/libutil/pw_util.c')
-rw-r--r--lib/libutil/pw_util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c
index af749d5240de..2838871d93f6 100644
--- a/lib/libutil/pw_util.c
+++ b/lib/libutil/pw_util.c
@@ -58,7 +58,6 @@ static const char rcsid[] =
#include <err.h>
#include <fcntl.h>
#include <inttypes.h>
-#include <libgen.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
@@ -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 */