From f24931e332589b25b779130a37d5f3491e609025 Mon Sep 17 00:00:00 2001 From: markm Date: Fri, 22 Feb 2002 20:45:09 +0000 Subject: Fix warnings inspired by lint, a commercial lint and WARNS=4 --- bin/chmod/chmod.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'bin/chmod') diff --git a/bin/chmod/chmod.c b/bin/chmod/chmod.c index 295e210..ff77de9 100644 --- a/bin/chmod/chmod.c +++ b/bin/chmod/chmod.c @@ -67,28 +67,27 @@ main(int argc, char *argv[]) FTSENT *p; mode_t *set; long val; - int oct, omode; - int Hflag, Lflag, Pflag, Rflag, ch, fflag, fts_options, hflag, rval; + int oct; + int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval; int vflag; char *ep, *mode; - int newmode; + mode_t newmode, omode; int (*change_mode)(const char *, mode_t); set = NULL; omode = 0; - Hflag = Lflag = Pflag = Rflag = fflag = hflag = vflag = 0; + Hflag = Lflag = Rflag = fflag = hflag = vflag = 0; while ((ch = getopt(argc, argv, "HLPRXfghorstuvwx")) != -1) switch (ch) { case 'H': Hflag = 1; - Lflag = Pflag = 0; + Lflag = 0; break; case 'L': Lflag = 1; - Hflag = Pflag = 0; + Hflag = 0; break; case 'P': - Pflag = 1; Hflag = Lflag = 0; break; case 'R': @@ -157,13 +156,13 @@ done: argv += optind; if (*mode >= '0' && *mode <= '7') { errno = 0; val = strtol(mode, &ep, 8); - if (val > INT_MAX || val < 0) + if (val > USHRT_MAX || val < 0) errno = ERANGE; if (errno) err(1, "invalid file mode: %s", mode); if (*ep) errx(1, "invalid file mode: %s", mode); - omode = val; + omode = (mode_t)val; oct = 1; } else { if ((set = setmode(mode)) == NULL) -- cgit v1.1