chroot,whoami: use uintmax_t for printing uids

* src/chroot.c (main): Cast the uid to uintmax_t instead of int.
* src/whoami.c (main): Cast the uid to uintmax_t instead of unsigned
long int.
This commit is contained in:
Collin Funk authored and Pádraig Brady committed 2024-10-07 11:47:57 +01:00
1 parent 0911361e79
commit 8083944484
2 files changed
+4 -3

No files matched your search

+2 -1
View File
@@ -375,7 +375,8 @@ main (int argc, char **argv)
else if (gid_unset (gid))
{
error (EXIT_CANCELED, errno,
_("no group specified for unknown uid: %d"), (int) uid);
_("no group specified for unknown uid: %ju"),
(uintmax_t) uid);
}
}
+2 -2
View File
@@ -81,8 +81,8 @@ main (int argc, char **argv)
uid = geteuid ();
pw = uid == NO_UID && errno ? nullptr : getpwuid (uid);
if (!pw)
error (EXIT_FAILURE, errno, _("cannot find name for user ID %lu"),
(unsigned long int) uid);
error (EXIT_FAILURE, errno, _("cannot find name for user ID %ju"),
(uintmax_t) uid);
puts (pw->pw_name);
return EXIT_SUCCESS;
}