summaryrefslogtreecommitdiff
path: root/bin/chmod/chmod.c
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2002-02-22 20:45:09 +0000
committerMark Murray <markm@FreeBSD.org>2002-02-22 20:45:09 +0000
commit71bea4f79d94bcf6f2423e80306d79ae46c5e0e2 (patch)
treecfe8734a9ff606ee6dd0da623ac620488ca1423f /bin/chmod/chmod.c
parent49b33de841af34b3b3e26b29a5af7c9f80d9e43d (diff)
downloadsrc-test2-71bea4f79d94bcf6f2423e80306d79ae46c5e0e2.tar.gz
src-test2-71bea4f79d94bcf6f2423e80306d79ae46c5e0e2.zip
Notes
Diffstat (limited to 'bin/chmod/chmod.c')
-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 295e21040610..ff77de9dfc78 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)