diff options
author | ed <ed@FreeBSD.org> | 2016-05-01 08:22:11 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2016-05-01 08:22:11 +0000 |
commit | 29410b4082844f1db01761aa2c06a05ea49034fc (patch) | |
tree | 3099b026b5642c95eb4110f7a0cc0b1c07db9061 /sbin/hastd | |
parent | 2c269d5a3e740c85443f6b546e9839dd127481c8 (diff) | |
download | FreeBSD-src-29410b4082844f1db01761aa2c06a05ea49034fc.zip FreeBSD-src-29410b4082844f1db01761aa2c06a05ea49034fc.tar.gz |
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 'sbin/hastd')
-rw-r--r-- | sbin/hastd/hooks.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sbin/hastd/hooks.c b/sbin/hastd/hooks.c index b1886ca..8cff3bf 100644 --- a/sbin/hastd/hooks.c +++ b/sbin/hastd/hooks.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <fcntl.h> -#include <libgen.h> #include <paths.h> #include <signal.h> #include <stdbool.h> @@ -352,7 +351,7 @@ hook_execv(const char *path, va_list ap) return; memset(args, 0, sizeof(args)); - args[0] = basename(path); + args[0] = __DECONST(char *, path); for (ii = 1; ii < sizeof(args) / sizeof(args[0]); ii++) { args[ii] = va_arg(ap, char *); if (args[ii] == NULL) |