From 1cd87ff3304cf463f1e4bed2b2d76ecd2db26aa2 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 16 Feb 1998 23:48:40 +0000 Subject: chflags() take u_int, not u_long. --- usr.bin/chflags/chflags.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'usr.bin/chflags') 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 #include +#include #include #include #include #include #include -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); -- cgit v1.2.3