1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

Do not compare unsigned int values with ULONG_MAX. The comparison is

always false on 64bit platforms and GCC 3.3.1 issues warning there.
This commit is contained in:
Alexander Kabaev 2003-07-11 05:47:05 +00:00
parent e67810e696
commit 8a50130bbb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117430
3 changed files with 7 additions and 7 deletions

View File

@ -164,7 +164,7 @@ main(int argc, char **argv)
if (!strncmp(optarg, MD_NAME, sizeof(MD_NAME) - 1))
optarg += sizeof(MD_NAME) - 1;
mdio.md_unit = strtoul(optarg, &p, 0);
if ((unsigned)mdio.md_unit == ULONG_MAX || *p != '\0')
if (mdio.md_unit == (unsigned)ULONG_MAX || *p != '\0')
errx(1, "bad unit: %s", optarg);
mdio.md_options &= ~MD_AUTOUNIT;
break;

View File

@ -246,7 +246,7 @@ main(int argc, char **argv)
unit = -1;
} else {
unit = strtoul(unitstr, &p, 10);
if ((unsigned)unit == ULONG_MAX || *p != '\0')
if (unit == (unsigned)ULONG_MAX || *p != '\0')
errx(1, "bad device unit: %s", unitstr);
}
@ -394,7 +394,7 @@ do_mdconfig_attach_au(const char *args, const enum md_types mdtype)
strncpy(linebuf, linep + mdnamelen, linelen);
linebuf[linelen] = '\0';
unit = strtoul(linebuf, &p, 10);
if ((unsigned)unit == ULONG_MAX || *p != '\n')
if (unit == (unsigned)ULONG_MAX || *p != '\n')
errx(1, "unexpected output from mdconfig (attach)");
fclose(sfd);
@ -513,7 +513,7 @@ extract_ugid(const char *str, struct mtpt_info *mip)
/* Derive uid. */
*uid = strtoul(user, &p, 10);
if ((unsigned)*uid == ULONG_MAX)
if (*uid == (uid_t)ULONG_MAX)
usage();
if (*p != '\0') {
pw = getpwnam(user);
@ -525,7 +525,7 @@ extract_ugid(const char *str, struct mtpt_info *mip)
/* Derive gid. */
*gid = strtoul(group, &p, 10);
if ((unsigned)*gid == ULONG_MAX)
if (*gid == (gid_t)ULONG_MAX)
usage();
if (*p != '\0') {
gr = getgrnam(group);

View File

@ -118,7 +118,7 @@ p_uid(char *p, struct passwd *pw, ENTRY *ep __unused)
}
errno = 0;
id = strtoul(p, &np, 10);
if (*np || (id == ULONG_MAX && errno == ERANGE)) {
if (*np || (id == (uid_t)ULONG_MAX && errno == ERANGE)) {
warnx("illegal uid");
return (-1);
}
@ -148,7 +148,7 @@ p_gid(char *p, struct passwd *pw, ENTRY *ep __unused)
}
errno = 0;
id = strtoul(p, &np, 10);
if (*np || (id == ULONG_MAX && errno == ERANGE)) {
if (*np || (id == (uid_t)ULONG_MAX && errno == ERANGE)) {
warnx("illegal gid");
return (-1);
}