]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/, src/: Say 'long' instead of 'long int'
authorAlejandro Colomar <alx@kernel.org>
Tue, 28 Nov 2023 01:05:45 +0000 (02:05 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sun, 3 Dec 2023 15:58:19 +0000 (09:58 -0600)
We were using 'long' in most places, so be consistent and use it
everywhere.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 files changed:
lib/defines.h
lib/get_gid.c
lib/get_pid.c
lib/get_uid.c
lib/getgr_nam_gid.c
lib/getlong.c
lib/getulong.c
lib/limits.c
lib/prefix_flag.c
lib/prototypes.h
lib/subordinateio.c
src/faillog.c
src/groupadd.c
src/groupmod.c
src/lastlog.c
src/newgidmap.c
src/newuidmap.c
src/useradd.c
src/usermod.c

index 969b1aa93c620275e93799444fccad8c20076ef9..4106a2086eb87ad6326780aa26ffec1e2826362a 100644 (file)
 #define SHADOW_PASSWD_STRING "x"
 #endif
 
-#define SHADOW_SP_FLAG_UNSET ((unsigned long int)-1)
+#define SHADOW_SP_FLAG_UNSET ((unsigned long)-1)
 
 #ifdef WITH_AUDIT
 #ifdef __u8                    /* in case we use pam < 0.80 */
index 26ce0319f66c4708cc0bfa6c0371f64d64b87874..a43a7d68b870536d40b66f65e4780d958eb5246d 100644 (file)
@@ -13,7 +13,7 @@
 
 int get_gid (const char *gidstr, gid_t *gid)
 {
-       long long int val;
+       long long  val;
        char *endptr;
 
        errno = 0;
index 20f4ce429b8ac6d2116c7a3392ee9a4e07dc8485..5eda20279385dee14550e87c57f9b074239f4d66 100644 (file)
@@ -16,7 +16,7 @@
 
 int get_pid (const char *pidstr, pid_t *pid)
 {
-       long long int val;
+       long long  val;
        char *endptr;
 
        errno = 0;
@@ -40,7 +40,7 @@ int get_pid (const char *pidstr, pid_t *pid)
  */
 int get_pidfd_from_fd(const char *pidfdstr)
 {
-       long long int val;
+       long long  val;
        char *endptr;
        struct stat st;
        dev_t proc_st_dev, proc_st_rdev;
index 4f9f311f070c96db010f866d72be5328bd5c614b..797b4bb917535f34c433b0adf05dbabf62b2cf54 100644 (file)
@@ -13,7 +13,7 @@
 
 int get_uid (const char *uidstr, uid_t *uid)
 {
-       long long int val;
+       long long  val;
        char *endptr;
 
        errno = 0;
index f3c2d4586db6abbbf4e2cda6a102e333550abd2b..53a9ee56ceb567750c16a639f9a6ee92936e7fd7 100644 (file)
@@ -23,7 +23,7 @@
  */
 extern /*@only@*//*@null@*/struct group *getgr_nam_gid (/*@null@*/const char *grname)
 {
-       long long int gid;
+       long long  gid;
        char *endptr;
 
        if (NULL == grname) {
index ec4aa54d04870a60a179a95fdb89c1df00e3aead..6317bf0fa521f2d09a67f621d32b3670a6856cd4 100644 (file)
@@ -19,7 +19,7 @@
  *
  * Returns 0 on failure, 1 on success.
  */
-int getlong (const char *numstr, /*@out@*/long int *result)
+int getlong (const char *numstr, /*@out@*/long *result)
 {
        long val;
        char *endptr;
index 33250e3a908771c5a4ca1b58f95c56a17499e13e..543fcd47a0134a0dfd0071166ac8e7f26f30a33c 100644 (file)
@@ -19,9 +19,9 @@
  *
  * Returns 0 on failure, 1 on success.
  */
-int getulong (const char *numstr, /*@out@*/unsigned long int *result)
+int getulong (const char *numstr, /*@out@*/unsigned long *result)
 {
-       unsigned long int val;
+       unsigned long  val;
        char *endptr;
 
        errno = 0;
index 1916f3452c11d3fa89bf01ae70ec2f6ea14c1e71..efb24a546353e7ebdd390cb55a783cbfb0e7162b 100644 (file)
@@ -105,7 +105,7 @@ static int set_prio (const char *value)
 
 static int set_umask (const char *value)
 {
-       unsigned long int mask;
+       unsigned long  mask;
 
        if (   (getulong (value, &mask) == 0)
            || (mask != (mode_t) mask)) {
@@ -483,7 +483,8 @@ void setup_limits (const struct passwd *info)
                        }
 
                        if (strncmp (cp, "pri=", 4) == 0) {
-                               long int inc;
+                               long  inc;
+
                                if (   (getlong (cp + 4, &inc) == 1)
                                    && (inc >= -20) && (inc <= 20)) {
                                        errno = 0;
@@ -501,7 +502,8 @@ void setup_limits (const struct passwd *info)
                                continue;
                        }
                        if (strncmp (cp, "ulimit=", 7) == 0) {
-                               long int blocks;
+                               long  blocks;
+
                                if (   (getlong (cp + 7, &blocks) == 0)
                                    || (blocks != (int) blocks)
                                    || (set_filesize_limit (blocks) != 0)) {
@@ -512,7 +514,8 @@ void setup_limits (const struct passwd *info)
                                continue;
                        }
                        if (strncmp (cp, "umask=", 6) == 0) {
-                               unsigned long int mask;
+                               unsigned long  mask;
+
                                if (   (getulong (cp + 6, &mask) == 0)
                                    || (mask != (mode_t) mask)) {
                                        SYSLOG ((LOG_WARN,
index 9d766818aa1b7595c04857e6360801289e4689e0..d55aeb97861797378dc5d2807e4a9c504d459ec0 100644 (file)
@@ -337,7 +337,7 @@ extern void prefix_endgrent(void)
 
 extern struct group *prefix_getgr_nam_gid(const char *grname)
 {
-       long long int gid;
+       long long  gid;
        char *endptr;
        struct group *g;
 
index 51118fd300516f9f52e73534b20cf5a4bbe05a09..3856d7f8ff8e5ed92c2a31023bd422936ee47c83 100644 (file)
@@ -153,7 +153,7 @@ extern int get_gid (const char *gidstr, gid_t *gid);
 extern /*@only@*//*@null@*/struct group *getgr_nam_gid (/*@null@*/const char *grname);
 
 /* getlong.c */
-extern int getlong (const char *numstr, /*@out@*/long int *result);
+extern int getlong (const char *numstr, /*@out@*/long *result);
 
 /* get_pid.c */
 extern int get_pid (const char *pidstr, pid_t *pid);
@@ -172,7 +172,7 @@ extern time_t gettime (void);
 extern int get_uid (const char *uidstr, uid_t *uid);
 
 /* getulong.c */
-extern int getulong (const char *numstr, /*@out@*/unsigned long int *result);
+extern int getulong (const char *numstr, /*@out@*/unsigned long *result);
 
 /* fputsx.c */
 extern /*@null@*/char *fgetsx (/*@returned@*/ /*@out@*/char *, int, FILE *);
index 5c5c00beaafcd46a2d0a91fbf51d13366941f0c8..f555b30a4a16891fa7b4e1884948cf6d59e6bc44 100644 (file)
@@ -233,7 +233,7 @@ static const struct subordinate_range *find_range(struct commonio_db *db,
                 return NULL;
         }
         owner_uid = pwd->pw_uid;
-        ret = snprintf(owner_uid_string, sizeof (owner_uid_string), "%lu", (unsigned long int)owner_uid);
+        ret = snprintf(owner_uid_string, sizeof (owner_uid_string), "%lu", (unsigned long)owner_uid);
         if (ret < 0 || (size_t)ret >= sizeof (owner_uid_string))
                 return NULL;
 
index 874528d88432f9afc7c8e63f85d8c4400d770aa8..e4eca198e9a8052453941bddb1adb298d1fe8131 100644 (file)
@@ -96,7 +96,7 @@ static off_t lookup_faillog(struct faillog *fl, uid_t uid)
        if (__builtin_mul_overflow(uid, sizeof(*fl), &offset)) {
                fprintf(stderr,
                        _("%s: Failed to get the entry for UID %lu\n"),
-                       Prog, (unsigned long int)uid);
+                       Prog, (unsigned long)uid);
                return -1;
        }
 
@@ -112,7 +112,7 @@ static off_t lookup_faillog(struct faillog *fl, uid_t uid)
                if (fread(fl, sizeof(*fl), 1, fail) != 1) {
                        fprintf(stderr,
                                _("%s: Failed to get the entry for UID %lu\n"),
-                               Prog, (unsigned long int)uid);
+                               Prog, (unsigned long)uid);
                        return -1;
                }
        } else {
@@ -246,7 +246,7 @@ static bool reset_one (uid_t uid)
 
        fprintf (stderr,
                 _("%s: Failed to reset fail count for UID %lu\n"),
-                Prog, (unsigned long int)uid);
+                Prog, (unsigned long)uid);
        return true;
 }
 
@@ -342,7 +342,7 @@ static bool setmax_one (uid_t uid, short max)
 
        fprintf (stderr,
                 _("%s: Failed to set max for UID %lu\n"),
-                Prog, (unsigned long int)uid);
+                Prog, (unsigned long)uid);
        return true;
 }
 
@@ -440,7 +440,7 @@ static bool set_locktime_one (uid_t uid, long locktime)
 
        fprintf (stderr,
                 _("%s: Failed to set locktime for UID %lu\n"),
-                Prog, (unsigned long int)uid);
+                Prog, (unsigned long)uid);
        return true;
 }
 
@@ -557,9 +557,10 @@ int main (int argc, char **argv)
                                break;
                        case 'm':
                        {
-                               long int lmax;
+                               long  lmax;
+
                                if (   (getlong (optarg, &lmax) == 0)
-                                   || ((long int)(short) lmax != lmax)) {
+                                   || ((long)(short) lmax != lmax)) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
                                                 Prog, optarg);
index 0a59509a8e50080e3854e14195268afdb16311c1..d06c3241036e4811a47316f89284f4b88732bc44 100644 (file)
@@ -511,7 +511,7 @@ static void check_flags (void)
                } else {
                        fprintf (stderr,
                                 _("%s: GID '%lu' already exists\n"),
-                                Prog, (unsigned long int) group_id);
+                                Prog, (unsigned long) group_id);
                        exit (E_GID_IN_USE);
                }
        }
index 11aca7f0c1a540a3d405e66c32abcb4fe6d9a6e4..3c04cdbd350cedee651d8858f45f6ea3c451948c 100644 (file)
@@ -339,7 +339,7 @@ static void check_new_gid (void)
         */
        fprintf (stderr,
                 _("%s: GID '%lu' already exists\n"),
-                Prog, (unsigned long int) group_newid);
+                Prog, (unsigned long) group_newid);
        exit (E_GID_IN_USE);
 }
 
index cd80de2e82ac80f52aab6d63904a7c3188538b26..f96a520c27af4ecaee8609ec8b008dc7faa5939a 100644 (file)
@@ -120,7 +120,7 @@ static void print_one (/*@null@*/const struct passwd *pw)
                if (fread (&ll, sizeof (ll), 1, lastlogfile) != 1) {
                        fprintf (stderr,
                                 _("%s: Failed to get the entry for UID %lu\n"),
-                                Prog, (unsigned long int)pw->pw_uid);
+                                Prog, (unsigned long)pw->pw_uid);
                        exit (EXIT_FAILURE);
                }
        } else {
@@ -242,7 +242,7 @@ static void update_one (/*@null@*/const struct passwd *pw)
        if (fwrite (&ll, sizeof(ll), 1, lastlogfile) != 1) {
                        fprintf (stderr,
                                 _("%s: Failed to update the entry for UID %lu\n"),
-                                Prog, (unsigned long int)pw->pw_uid);
+                                Prog, (unsigned long)pw->pw_uid);
                        exit (EXIT_FAILURE);
        }
 }
index d6d29725ca371b685a62298349cf3cfec6d814f7..39cb66bebed757b7de1500d4e7195db947d1e537 100644 (file)
@@ -206,8 +206,8 @@ int main(int argc, char **argv)
            (getgid() != st.st_gid)) {
                fprintf(stderr, _( "%s: Target process is owned by a different user: uid:%lu pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n" ),
                        Prog,
-                       (unsigned long int)getuid(), (unsigned long int)pw->pw_uid, (unsigned long int)st.st_uid,
-                       (unsigned long int)getgid(), (unsigned long int)pw->pw_gid, (unsigned long int)st.st_gid);
+                       (unsigned long)getuid(), (unsigned long)pw->pw_uid, (unsigned long)st.st_uid,
+                       (unsigned long)getgid(), (unsigned long)pw->pw_gid, (unsigned long)st.st_gid);
                return EXIT_FAILURE;
        }
 
index e99655c9282e98708f45f2b4fbcf743d509f7e0e..5e8c7f3a8cfda16e0ac90cbcadb148cb28dd5044 100644 (file)
@@ -134,8 +134,8 @@ int main(int argc, char **argv)
            (getgid() != st.st_gid)) {
                fprintf(stderr, _( "%s: Target process is owned by a different user: uid:%lu pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n" ),
                        Prog,
-                       (unsigned long int)getuid(), (unsigned long int)pw->pw_uid, (unsigned long int)st.st_uid,
-                       (unsigned long int)getgid(), (unsigned long int)pw->pw_gid, (unsigned long int)st.st_gid);
+                       (unsigned long)getuid(), (unsigned long)pw->pw_uid, (unsigned long)st.st_uid,
+                       (unsigned long)getgid(), (unsigned long)pw->pw_gid, (unsigned long)st.st_gid);
                return EXIT_FAILURE;
        }
 
index 9c00d6466db36d3347d01ddac9c34add22978ffa..8a5974822f1c4735cd986dde0f8ca8fc4386f468 100644 (file)
@@ -875,7 +875,7 @@ static struct group * get_local_group(char * grp_name)
 {
        const struct group *grp;
        struct group *result_grp = NULL;
-       long long int gid;
+       long long  gid;
        char *endptr;
 
        gid = strtoll (grp_name, &endptr, 10);
index 4f7c7f487a4c3830583ebc675cb2a5a112c697a4..d279981bb40a36bdf31f2914ffe65364cd776a7a 100644 (file)
@@ -319,20 +319,20 @@ static struct ulong_range getulong_range(const char *str)
        errno = 0;
        first = strtoll(str, &pos, 10);
        if (('\0' == *str) || ('-' != *pos ) || (ERANGE == errno) ||
-           (first != (unsigned long int)first))
+           (first != (unsigned long)first))
                goto out;
 
        errno = 0;
        last = strtoll(pos + 1, &pos, 10);
        if (('\0' != *pos ) || (ERANGE == errno) ||
-           (last != (unsigned long int)last))
+           (last != (unsigned long)last))
                goto out;
 
        if (first > last)
                goto out;
 
-       result.first = (unsigned long int)first;
-       result.last = (unsigned long int)last;
+       result.first = (unsigned long)first;
+       result.last = (unsigned long)last;
 out:
        return result;
 }