summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-09-26 08:39:20 +0000
committerJim Meyering <jim@meyering.net>2002-09-26 08:39:20 +0000
commit0327689de0c98e5b372c18b259f9956ac1de2fc3 (patch)
tree9f559397e83d4ae63ce73e650be5c21f079df097
parentd50e1a86b7a8b36f63b5d6bab978b9765ac28f7e (diff)
downloadcoreutils-0327689de0c98e5b372c18b259f9956ac1de2fc3.tar.xz
(get_ids): Use strtoul, not strtol. Remove some casts.
-rw-r--r--src/install.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/install.c b/src/install.c
index 5f81fdba7..c27c3b7ee 100644
--- a/src/install.c
+++ b/src/install.c
@@ -554,11 +554,11 @@ get_ids (void)
pw = getpwnam (owner_name);
if (pw == NULL)
{
- long int tmp_long;
- if (xstrtol (owner_name, NULL, 0, &tmp_long, NULL) != LONGINT_OK
- || !(0 <= tmp_long && (uid_t) tmp_long <= UID_T_MAX))
+ unsigned long int tmp;
+ if (xstrtoul (owner_name, NULL, 0, &tmp, NULL) != LONGINT_OK
+ || UID_T_MAX < tmp)
error (EXIT_FAILURE, 0, _("invalid user %s"), quote (owner_name));
- owner_id = (uid_t) tmp_long;
+ owner_id = tmp;
}
else
owner_id = pw->pw_uid;
@@ -572,11 +572,11 @@ get_ids (void)
gr = getgrnam (group_name);
if (gr == NULL)
{
- long int tmp_long;
- if (xstrtol (group_name, NULL, 0, &tmp_long, NULL) != LONGINT_OK
- || !(0 <= tmp_long && (gid_t) tmp_long <= GID_T_MAX))
+ unsigned long int tmp;
+ if (xstrtoul (group_name, NULL, 0, &tmp, NULL) != LONGINT_OK
+ || GID_T_MAX < tmp)
error (EXIT_FAILURE, 0, _("invalid group %s"), quote (group_name));
- group_id = (gid_t) tmp_long;
+ group_id = tmp;
}
else
group_id = gr->gr_gid;