diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/chflags/chflags.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/chflags/chflags.c b/usr.bin/chflags/chflags.c index a5f01bed330..f8f456bfa1a 100644 --- a/usr.bin/chflags/chflags.c +++ b/usr.bin/chflags/chflags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chflags.c,v 1.2 1996/06/26 05:31:52 deraadt Exp $ */ +/* $OpenBSD: chflags.c,v 1.3 1998/02/16 23:48:39 millert Exp $ */ /* $NetBSD: chflags.c,v 1.4 1995/03/26 08:49:20 glass Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "from: @(#)chflags.c 8.5 (Berkeley) 4/1/94"; #else -static char rcsid[] = "$OpenBSD: chflags.c,v 1.2 1996/06/26 05:31:52 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: chflags.c,v 1.3 1998/02/16 23:48:39 millert Exp $"; #endif #endif /* not lint */ @@ -53,13 +53,14 @@ static char rcsid[] = "$OpenBSD: chflags.c,v 1.2 1996/06/26 05:31:52 deraadt Exp #include <err.h> #include <errno.h> +#include <limits.h> #include <fts.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -u_long string_to_flags __P((char **, u_long *, u_long *)); +u_int string_to_flags __P((char **, u_int *, u_int *)); void usage __P((void)); int @@ -69,8 +70,8 @@ main(argc, argv) { FTS *ftsp; FTSENT *p; - u_long clear, set; - long val; + u_int clear, set; + u_long val; int Hflag, Lflag, Pflag, Rflag, ch, fts_options, oct, rval; char *flags, *ep; @@ -115,8 +116,8 @@ main(argc, argv) flags = *argv; if (*flags >= '0' && *flags <= '7') { errno = 0; - val = strtol(flags, &ep, 8); - if (val < 0) + val = strtoul(flags, &ep, 8); + if (val > UINT_MAX) errno = ERANGE; if (errno) err(1, "invalid flags: %s", flags); |