lib/, src/: Say 'long' instead of 'long int'

We were using 'long' in most places, so be consistent and use it
everywhere.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2023-11-28 02:05:45 +01:00
committed by Serge Hallyn
parent 44b8f7b3ef
commit 4f16458b6c
19 changed files with 41 additions and 37 deletions

View File

@@ -190,7 +190,7 @@
#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 */

View 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;

View 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;

View 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;

View 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) {

View 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;

View 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;

View 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,

View 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;

View 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 *);

View 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;

View 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);

View 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);
}
}

View 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);
}

View 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);
}
}

View 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;
}

View 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;
}

View 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);

View 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;
}