summaryrefslogtreecommitdiffstats
path: root/bin/chmod
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2002-02-22 20:45:09 +0000
committermarkm <markm@FreeBSD.org>2002-02-22 20:45:09 +0000
commitf24931e332589b25b779130a37d5f3491e609025 (patch)
treecfe8734a9ff606ee6dd0da623ac620488ca1423f /bin/chmod
parent7f5881c8e019de198b8cb0efcd646063074066ec (diff)
downloadFreeBSD-src-f24931e332589b25b779130a37d5f3491e609025.zip
FreeBSD-src-f24931e332589b25b779130a37d5f3491e609025.tar.gz
Fix warnings inspired by lint, a commercial lint and WARNS=4
Diffstat (limited to 'bin/chmod')
-rw-r--r--bin/chmod/chmod.c17
1 files changed, 8 insertions, 9 deletions
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)
OpenPOWER on IntegriCloud