mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 08:41:05 +01:00
Fix warnings inspired by lint, a commercial lint and WARNS=4
This commit is contained in:
parent
49b33de841
commit
71bea4f79d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91078
@ -67,28 +67,27 @@ main(int argc, char *argv[])
|
|||||||
FTSENT *p;
|
FTSENT *p;
|
||||||
mode_t *set;
|
mode_t *set;
|
||||||
long val;
|
long val;
|
||||||
int oct, omode;
|
int oct;
|
||||||
int Hflag, Lflag, Pflag, Rflag, ch, fflag, fts_options, hflag, rval;
|
int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval;
|
||||||
int vflag;
|
int vflag;
|
||||||
char *ep, *mode;
|
char *ep, *mode;
|
||||||
int newmode;
|
mode_t newmode, omode;
|
||||||
int (*change_mode)(const char *, mode_t);
|
int (*change_mode)(const char *, mode_t);
|
||||||
|
|
||||||
set = NULL;
|
set = NULL;
|
||||||
omode = 0;
|
omode = 0;
|
||||||
Hflag = Lflag = Pflag = Rflag = fflag = hflag = vflag = 0;
|
Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
|
||||||
while ((ch = getopt(argc, argv, "HLPRXfghorstuvwx")) != -1)
|
while ((ch = getopt(argc, argv, "HLPRXfghorstuvwx")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'H':
|
case 'H':
|
||||||
Hflag = 1;
|
Hflag = 1;
|
||||||
Lflag = Pflag = 0;
|
Lflag = 0;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
Lflag = 1;
|
Lflag = 1;
|
||||||
Hflag = Pflag = 0;
|
Hflag = 0;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
Pflag = 1;
|
|
||||||
Hflag = Lflag = 0;
|
Hflag = Lflag = 0;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
@ -157,13 +156,13 @@ done: argv += optind;
|
|||||||
if (*mode >= '0' && *mode <= '7') {
|
if (*mode >= '0' && *mode <= '7') {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
val = strtol(mode, &ep, 8);
|
val = strtol(mode, &ep, 8);
|
||||||
if (val > INT_MAX || val < 0)
|
if (val > USHRT_MAX || val < 0)
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
if (errno)
|
if (errno)
|
||||||
err(1, "invalid file mode: %s", mode);
|
err(1, "invalid file mode: %s", mode);
|
||||||
if (*ep)
|
if (*ep)
|
||||||
errx(1, "invalid file mode: %s", mode);
|
errx(1, "invalid file mode: %s", mode);
|
||||||
omode = val;
|
omode = (mode_t)val;
|
||||||
oct = 1;
|
oct = 1;
|
||||||
} else {
|
} else {
|
||||||
if ((set = setmode(mode)) == NULL)
|
if ((set = setmode(mode)) == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user