summaryrefslogtreecommitdiffstats
path: root/libutil
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
commit43a4c1fb04198fbbe485d55de4a1056d3ec23d2d (patch)
tree7bb2647a60b5279651825d1fa0f5a1d88eedec60 /libutil
parent627721b77ce09502b2d23c44eba53e00ad792d2e (diff)
downloadpw-darwin-43a4c1fb04198fbbe485d55de4a1056d3ec23d2d.tar.gz
pw-darwin-43a4c1fb04198fbbe485d55de4a1056d3ec23d2d.tar.zst
pw-darwin-43a4c1fb04198fbbe485d55de4a1056d3ec23d2d.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
Diffstat (limited to 'libutil')
-rw-r--r--libutil/pw_util.c3
1 files changed, 1 insertions, 2 deletions
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 <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 */