diff options
author | 2019-03-10 15:11:52 +0000 | |
---|---|---|
committer | 2019-03-10 15:11:52 +0000 | |
commit | bf2dd1059f4f9b97b496511da0a6bc41a2adfe6b (patch) | |
tree | c230d4a0d16c3ee339ed79b5a4a84ce4b65e6f6b | |
parent | rename CRYPTO_set_locking_callback.3 to CRYPTO_lock.3 (diff) | |
download | wireguard-openbsd-bf2dd1059f4f9b97b496511da0a6bc41a2adfe6b.tar.xz wireguard-openbsd-bf2dd1059f4f9b97b496511da0a6bc41a2adfe6b.zip |
Delete a useless call to setlocale(3): strptime(3) is only called
with %F and %T, neither of which is locale-dependent, and nothing
else in the code depends on the locale either, since most of the
parsing is done by hand and only supports numerical formats in the
first place.
While here, make usage() static and return from main rather than exit(3).
Patch from Jan Stary <hans at stare dot cz>.
tedu@ agrees.
-rw-r--r-- | usr.bin/touch/touch.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c index ec4821eac37..114b6759f6a 100644 --- a/usr.bin/touch/touch.c +++ b/usr.bin/touch/touch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: touch.c,v 1.25 2015/10/09 01:37:09 deraadt Exp $ */ +/* $OpenBSD: touch.c,v 1.26 2019/03/10 15:11:52 schwarze Exp $ */ /* $NetBSD: touch.c,v 1.11 1995/08/31 22:10:06 jtc Exp $ */ /* @@ -41,7 +41,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <locale.h> #include <time.h> #include <unistd.h> @@ -49,7 +48,7 @@ void stime_arg1(char *, struct timespec *); void stime_arg2(char *, int, struct timespec *); void stime_argd(char *, struct timespec *); void stime_file(char *, struct timespec *); -__dead void usage(void); +static void __dead usage(void); int main(int argc, char *argv[]) @@ -58,8 +57,6 @@ main(int argc, char *argv[]) int aflag, cflag, mflag, ch, fd, len, rval, timeset; char *p; - (void)setlocale(LC_ALL, ""); - if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) err(1, "pledge"); @@ -145,7 +142,7 @@ main(int argc, char *argv[]) warn("%s", *argv); } } - exit(rval); + return rval; } #define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0')) @@ -324,7 +321,7 @@ terr: errx(1, tsp[1] = tsp[0]; } -__dead void +static void __dead usage(void) { (void)fprintf(stderr, |