]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Use 'uintmax_t' to print 'gid_t'
authorAlejandro Colomar <alx@kernel.org>
Fri, 16 Dec 2022 00:06:09 +0000 (01:06 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Thu, 22 Dec 2022 09:34:04 +0000 (10:34 +0100)
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>
src/groupmod.c

index 828c7c0bf6dd402d9f2d497264094299c305da63..7802e5b104551e8a07415af4fa601a62c14b39d9 100644 (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