Use 'uintmax_t' to print 'gid_t'

This is shorter to write than 'unsigned long int', so we can collapse
some lines.  It is guaranteed by C99.

Link: <https://github.com/shadow-maint/shadow/pull/607>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar 2022-12-16 01:06:09 +01:00 committed by Iker Pedrosa
parent 587ce83e3f
commit 06c30450ce

View File

@ -15,6 +15,7 @@
#include <fcntl.h>
#include <getopt.h>
#include <grp.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef ACCT_TOOLS_SETUID
@ -574,8 +575,7 @@ static void prepare_failure_reports (void)
(void) snprintf (info_group.action,
512 - strlen (info_group.audit_msg),
"group %s/%lu",
group_name, (unsigned long int) group_id);
"group %s/%ju", group_name, (uintmax_t) group_id);
#ifdef SHADOWGRP
(void) snprintf (info_gshadow.action,
512 - strlen (info_group.audit_msg),
@ -583,8 +583,7 @@ static void prepare_failure_reports (void)
#endif
(void) snprintf (info_passwd.action,
512 - strlen (info_group.audit_msg),
"group %s/%lu",
group_name, (unsigned long int) group_id);
"group %s/%ju", group_name, (uintmax_t) group_id);
if (nflg) {
strncat (info_group.action, ", new name: ",
@ -618,13 +617,13 @@ static void prepare_failure_reports (void)
511 - strlen (info_group.audit_msg));
(void) snprintf (info_group.action+strlen (info_group.action),
512 - strlen (info_group.audit_msg),
"%lu", (unsigned long int) group_newid);
"%ju", (uintmax_t) group_newid);
strncat (info_passwd.action, ", new gid: ",
511 - strlen (info_passwd.audit_msg));
(void) snprintf (info_passwd.action+strlen (info_passwd.action),
512 - strlen (info_passwd.audit_msg),
"%lu", (unsigned long int) group_newid);
"%ju", (uintmax_t) group_newid);
}
info_group.audit_msg[511] = '\0';
#ifdef SHADOWGRP