summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-01-16 21:38:24 +0100
committerSerge Hallyn <serge@hallyn.com>2024-03-29 14:29:13 -0500
commitf39ac101ff48beea7fc03efb924806fdfeef92f3 (patch)
tree0d5160a6957c5f3336f3002178031f3dd19d8bd1
parentb085c3f612e61d06d7c452953c7e097430ba1b3c (diff)
lib/, src/: str2*(): Rename functions and reorder parameters
This makes them compatible with liba2i's functions. Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--lib/atoi/str2i.c4
-rw-r--r--lib/atoi/str2i.h12
-rw-r--r--lib/getdef.c8
-rw-r--r--lib/idmapping.c6
-rw-r--r--lib/limits.c14
-rw-r--r--lib/rlogin.c3
-rw-r--r--lib/sgetspent.c14
-rw-r--r--lib/shadow.c14
-rw-r--r--lib/strtoday.c3
-rw-r--r--lib/subordinateio.c4
-rw-r--r--src/chage.c16
-rw-r--r--src/chgpasswd.c6
-rw-r--r--src/chpasswd.c6
-rw-r--r--src/faillog.c6
-rw-r--r--src/lastlog.c4
-rw-r--r--src/newusers.c6
-rw-r--r--src/passwd.c8
-rw-r--r--src/useradd.c4
-rw-r--r--src/usermod.c2
19 files changed, 69 insertions, 71 deletions
diff --git a/lib/atoi/str2i.c b/lib/atoi/str2i.c
index 1fae5a3a..127ac827 100644
--- a/lib/atoi/str2i.c
+++ b/lib/atoi/str2i.c
@@ -8,5 +8,5 @@
#include "atoi/str2i.h"
-extern inline int getlong(const char *restrict s, long *restrict n);
-extern inline int getulong(const char *restrict s, unsigned long *restrict n);
+extern inline int str2sl(long *restrict n, const char *restrict s);
+extern inline int str2ul(unsigned long *restrict n, const char *restrict s);
diff --git a/lib/atoi/str2i.h b/lib/atoi/str2i.h
index b72c509f..ee3cece1 100644
--- a/lib/atoi/str2i.h
+++ b/lib/atoi/str2i.h
@@ -16,21 +16,21 @@
#include "attr.h"
-ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
-inline int getlong(const char *restrict s, long *restrict n);
-ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
-inline int getulong(const char *restrict s, unsigned long *restrict n);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2sl(long *restrict n, const char *restrict s);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2ul(unsigned long *restrict n, const char *restrict s);
inline int
-getlong(const char *restrict s, long *restrict n)
+str2sl(long *restrict n, const char *restrict s)
{
return a2sl(n, s, NULL, 0, LONG_MIN, LONG_MAX);
}
inline int
-getulong(const char *restrict s, unsigned long *restrict n)
+str2ul(unsigned long *restrict n, const char *restrict s)
{
return a2ul(n, s, NULL, 0, 0, ULONG_MAX);
}
diff --git a/lib/getdef.c b/lib/getdef.c
index 41a330fa..30f54bab 100644
--- a/lib/getdef.c
+++ b/lib/getdef.c
@@ -246,7 +246,7 @@ int getdef_num (const char *item, int dflt)
return dflt;
}
- if ( (getlong(d->value, &val) == -1)
+ if ( (str2sl(&val, d->value) == -1)
|| (val > INT_MAX)
|| (val < -1)) {
fprintf (shadow_logfd,
@@ -281,7 +281,7 @@ unsigned int getdef_unum (const char *item, unsigned int dflt)
return dflt;
}
- if ( (getlong(d->value, &val) == -1)
+ if ( (str2sl(&val, d->value) == -1)
|| (val < 0)
|| (val > INT_MAX)) {
fprintf (shadow_logfd,
@@ -316,7 +316,7 @@ long getdef_long (const char *item, long dflt)
return dflt;
}
- if (getlong(d->value, &val) == -1 || val < -1) {
+ if (str2sl(&val, d->value) == -1 || val < -1) {
fprintf (shadow_logfd,
_("configuration error - cannot parse %s value: '%s'"),
item, d->value);
@@ -348,7 +348,7 @@ unsigned long getdef_ulong (const char *item, unsigned long dflt)
return dflt;
}
- if (getulong(d->value, &val) == -1) {
+ if (str2ul(&val, d->value) == -1) {
fprintf (shadow_logfd,
_("configuration error - cannot parse %s value: '%s'"),
item, d->value);
diff --git a/lib/idmapping.c b/lib/idmapping.c
index b8f0e010..56c72eae 100644
--- a/lib/idmapping.c
+++ b/lib/idmapping.c
@@ -51,15 +51,15 @@ struct map_range *get_map_ranges(int ranges, int argc, char **argv)
/* Gather up the ranges from the command line */
mapping = mappings;
for (idx = 0, argidx = 0; idx < ranges; idx++, argidx += 3, mapping++) {
- if (getulong(argv[argidx + 0], &mapping->upper) == -1) {
+ if (str2ul(&mapping->upper, argv[argidx + 0]) == -1) {
free(mappings);
return NULL;
}
- if (getulong(argv[argidx + 1], &mapping->lower) == -1) {
+ if (str2ul(&mapping->lower, argv[argidx + 1]) == -1) {
free(mappings);
return NULL;
}
- if (getulong(argv[argidx + 2], &mapping->count) == -1) {
+ if (str2ul(&mapping->count, argv[argidx + 2]) == -1) {
free(mappings);
return NULL;
}
diff --git a/lib/limits.c b/lib/limits.c
index c6c041c5..387a972b 100644
--- a/lib/limits.c
+++ b/lib/limits.c
@@ -61,7 +61,7 @@ static int setrlimit_value (unsigned int resource,
limit = RLIM_INFINITY;
}
else {
- /* We cannot use getlong here because it fails when there
+ /* We cannot use str2sl() here because it fails when there
* is more to the value than just this number!
* Also, we are limited to base 10 here (hex numbers will not
* work with the limit string parser as is anyway)
@@ -93,7 +93,7 @@ static int set_prio (const char *value)
{
long prio;
- if ( (getlong(value, &prio) == -1)
+ if ( (str2sl(&prio, value) == -1)
|| (prio != (int) prio)) {
return 0;
}
@@ -108,7 +108,7 @@ static int set_umask (const char *value)
{
unsigned long mask;
- if ( (getulong(value, &mask) == -1)
+ if ( (str2ul(&mask, value) == -1)
|| (mask != (mode_t) mask)) {
return 0;
}
@@ -123,7 +123,7 @@ static int check_logins (const char *name, const char *maxlogins)
{
unsigned long limit, count;
- if (getulong(maxlogins, &limit) == -1) {
+ if (str2ul(&limit, maxlogins) == -1) {
return 0;
}
@@ -486,7 +486,7 @@ void setup_limits (const struct passwd *info)
if (strncmp (cp, "pri=", 4) == 0) {
long inc;
- if ( (getlong(cp + 4, &inc) == 0)
+ if ( (str2sl(&inc, cp + 4) == 0)
&& (inc >= -20) && (inc <= 20)) {
errno = 0;
if ( (nice (inc) != -1)
@@ -504,7 +504,7 @@ void setup_limits (const struct passwd *info)
}
if (strncmp (cp, "ulimit=", 7) == 0) {
long blocks;
- if ( (getlong(cp + 7, &blocks) == -1)
+ if ( (str2sl(&blocks, cp + 7) == -1)
|| (blocks != (int) blocks)
|| (set_filesize_limit (blocks) != 0)) {
SYSLOG ((LOG_WARN,
@@ -516,7 +516,7 @@ void setup_limits (const struct passwd *info)
if (strncmp (cp, "umask=", 6) == 0) {
unsigned long mask;
- if ( (getulong(cp + 6, &mask) == -1)
+ if ( (str2ul(&mask, cp + 6) == -1)
|| (mask != (mode_t) mask)) {
SYSLOG ((LOG_WARN,
"Can't set umask value for user %s",
diff --git a/lib/rlogin.c b/lib/rlogin.c
index 792dc9f8..cbc05dd8 100644
--- a/lib/rlogin.c
+++ b/lib/rlogin.c
@@ -86,9 +86,8 @@ do_rlogin(const char *remote_host, char *name, size_t namesize, char *term,
*cp = '\0';
cp++;
- if (getulong(cp, &remote_speed) == -1) {
+ if (str2ul(&remote_speed, cp) == -1)
remote_speed = 9600;
- }
}
for (i = 0;
( (speed_table[i].spd_baud != remote_speed)
diff --git a/lib/sgetspent.c b/lib/sgetspent.c
index 64a9c54a..bd2ef8b8 100644
--- a/lib/sgetspent.c
+++ b/lib/sgetspent.c
@@ -98,7 +98,7 @@ sgetspent(const char *string)
if (fields[2][0] == '\0') {
spwd.sp_lstchg = -1;
- } else if ( (getlong(fields[2], &spwd.sp_lstchg) == -1)
+ } else if ( (str2sl(&spwd.sp_lstchg, fields[2]) == -1)
|| (spwd.sp_lstchg < 0)) {
return NULL;
}
@@ -109,7 +109,7 @@ sgetspent(const char *string)
if (fields[3][0] == '\0') {
spwd.sp_min = -1;
- } else if ( (getlong(fields[3], &spwd.sp_min) == -1)
+ } else if ( (str2sl(&spwd.sp_min, fields[3]) == -1)
|| (spwd.sp_min < 0)) {
return NULL;
}
@@ -120,7 +120,7 @@ sgetspent(const char *string)
if (fields[4][0] == '\0') {
spwd.sp_max = -1;
- } else if ( (getlong(fields[4], &spwd.sp_max) == -1)
+ } else if ( (str2sl(&spwd.sp_max, fields[4]) == -1)
|| (spwd.sp_max < 0)) {
return NULL;
}
@@ -145,7 +145,7 @@ sgetspent(const char *string)
if (fields[5][0] == '\0') {
spwd.sp_warn = -1;
- } else if ( (getlong(fields[5], &spwd.sp_warn) == -1)
+ } else if ( (str2sl(&spwd.sp_warn, fields[5]) == -1)
|| (spwd.sp_warn < 0)) {
return NULL;
}
@@ -157,7 +157,7 @@ sgetspent(const char *string)
if (fields[6][0] == '\0') {
spwd.sp_inact = -1;
- } else if ( (getlong(fields[6], &spwd.sp_inact) == -1)
+ } else if ( (str2sl(&spwd.sp_inact, fields[6]) == -1)
|| (spwd.sp_inact < 0)) {
return NULL;
}
@@ -169,7 +169,7 @@ sgetspent(const char *string)
if (fields[7][0] == '\0') {
spwd.sp_expire = -1;
- } else if ( (getlong(fields[7], &spwd.sp_expire) == -1)
+ } else if ( (str2sl(&spwd.sp_expire, fields[7]) == -1)
|| (spwd.sp_expire < 0)) {
return NULL;
}
@@ -181,7 +181,7 @@ sgetspent(const char *string)
if (fields[8][0] == '\0') {
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
- } else if (getulong(fields[8], &spwd.sp_flag) == -1) {
+ } else if (str2ul(&spwd.sp_flag, fields[8]) == -1) {
return NULL;
}
diff --git a/lib/shadow.c b/lib/shadow.c
index f14f4937..f17d09ee 100644
--- a/lib/shadow.c
+++ b/lib/shadow.c
@@ -118,7 +118,7 @@ static struct spwd *my_sgetspent (const char *string)
if (fields[2][0] == '\0') {
spwd.sp_lstchg = -1;
} else {
- if (getlong(fields[2], &spwd.sp_lstchg) == -1)
+ if (str2sl(&spwd.sp_lstchg, fields[2]) == -1)
return 0;
if (spwd.sp_lstchg < 0)
return 0;
@@ -131,7 +131,7 @@ static struct spwd *my_sgetspent (const char *string)
if (fields[3][0] == '\0') {
spwd.sp_min = -1;
} else {
- if (getlong(fields[3], &spwd.sp_min) == -1)
+ if (str2sl(&spwd.sp_min, fields[3]) == -1)
return 0;
if (spwd.sp_min < 0)
return 0;
@@ -144,7 +144,7 @@ static struct spwd *my_sgetspent (const char *string)
if (fields[4][0] == '\0') {
spwd.sp_max = -1;
} else {
- if (getlong(fields[4], &spwd.sp_max) == -1)
+ if (str2sl(&spwd.sp_max, fields[4]) == -1)
return 0;
if (spwd.sp_max < 0)
return 0;
@@ -171,7 +171,7 @@ static struct spwd *my_sgetspent (const char *string)
if (fields[5][0] == '\0') {
spwd.sp_warn = -1;
} else {
- if (getlong(fields[5], &spwd.sp_warn) == -1)
+ if (str2sl(&spwd.sp_warn, fields[5]) == -1)
return 0;
if (spwd.sp_warn < 0)
return 0;
@@ -185,7 +185,7 @@ static struct spwd *my_sgetspent (const char *string)
if (fields[6][0] == '\0') {
spwd.sp_inact = -1;
} else {
- if (getlong(fields[6], &spwd.sp_inact) == -1)
+ if (str2sl(&spwd.sp_inact, fields[6]) == -1)
return 0;
if (spwd.sp_inact < 0)
return 0;
@@ -199,7 +199,7 @@ static struct spwd *my_sgetspent (const char *string)
if (fields[7][0] == '\0') {
spwd.sp_expire = -1;
} else {
- if (getlong(fields[7], &spwd.sp_expire) == -1)
+ if (str2sl(&spwd.sp_expire, fields[7]) == -1)
return 0;
if (spwd.sp_expire < 0)
return 0;
@@ -213,7 +213,7 @@ static struct spwd *my_sgetspent (const char *string)
if (fields[8][0] == '\0') {
spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
} else {
- if (getulong(fields[8], &spwd.sp_flag) == -1)
+ if (str2ul(&spwd.sp_flag, fields[8]) == -1)
return 0;
if (spwd.sp_flag < 0)
return 0;
diff --git a/lib/strtoday.c b/lib/strtoday.c
index 46766a68..dabd5b52 100644
--- a/lib/strtoday.c
+++ b/lib/strtoday.c
@@ -64,9 +64,8 @@ long strtoday (const char *str)
}
if (isnum) {
long retdate;
- if (getlong(str, &retdate) == -1) {
+ if (str2sl(&retdate, str) == -1)
return -2;
- }
return retdate;
}
diff --git a/lib/subordinateio.c b/lib/subordinateio.c
index 38b09a5e..e7cd4b48 100644
--- a/lib/subordinateio.c
+++ b/lib/subordinateio.c
@@ -108,9 +108,9 @@ subordinate_parse(const char *line)
if (i != SUBID_NFIELDS || *fields[0] == '\0' || *fields[1] == '\0' || *fields[2] == '\0')
return NULL;
range.owner = fields[0];
- if (getulong(fields[1], &range.start) == -1)
+ if (str2ul(&range.start, fields[1]) == -1)
return NULL;
- if (getulong(fields[2], &range.count) == -1)
+ if (str2ul(&range.count, fields[2]) == -1)
return NULL;
return &range;
diff --git a/src/chage.c b/src/chage.c
index 20a1c296..1edab47f 100644
--- a/src/chage.c
+++ b/src/chage.c
@@ -171,14 +171,14 @@ static int new_fields (void)
SNPRINTF(buf, "%ld", mindays);
change_field (buf, sizeof buf, _("Minimum Password Age"));
- if ( (getlong(buf, &mindays) == -1)
+ if ( (str2sl(&mindays, buf) == -1)
|| (mindays < -1)) {
return 0;
}
SNPRINTF(buf, "%ld", maxdays);
change_field (buf, sizeof buf, _("Maximum Password Age"));
- if ( (getlong(buf, &maxdays) == -1)
+ if ( (str2sl(&maxdays, buf) == -1)
|| (maxdays < -1)) {
return 0;
}
@@ -201,14 +201,14 @@ static int new_fields (void)
SNPRINTF(buf, "%ld", warndays);
change_field (buf, sizeof buf, _("Password Expiration Warning"));
- if ( (getlong(buf, &warndays) == -1)
+ if ( (str2sl(&warndays, buf) == -1)
|| (warndays < -1)) {
return 0;
}
SNPRINTF(buf, "%ld", inactdays);
change_field (buf, sizeof buf, _("Password Inactive"));
- if ( (getlong(buf, &inactdays) == -1)
+ if ( (str2sl(&inactdays, buf) == -1)
|| (inactdays < -1)) {
return 0;
}
@@ -397,7 +397,7 @@ static void process_flags (int argc, char **argv)
break;
case 'I':
Iflg = true;
- if ( (getlong(optarg, &inactdays) == -1)
+ if ( (str2sl(&inactdays, optarg) == -1)
|| (inactdays < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
@@ -410,7 +410,7 @@ static void process_flags (int argc, char **argv)
break;
case 'm':
mflg = true;
- if ( (getlong(optarg, &mindays) == -1)
+ if ( (str2sl(&mindays, optarg) == -1)
|| (mindays < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
@@ -420,7 +420,7 @@ static void process_flags (int argc, char **argv)
break;
case 'M':
Mflg = true;
- if ( (getlong(optarg, &maxdays) == -1)
+ if ( (str2sl(&maxdays, optarg) == -1)
|| (maxdays < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
@@ -434,7 +434,7 @@ static void process_flags (int argc, char **argv)
break;
case 'W':
Wflg = true;
- if ( (getlong(optarg, &warndays) == -1)
+ if ( (str2sl(&warndays, optarg) == -1)
|| (warndays < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
diff --git a/src/chgpasswd.c b/src/chgpasswd.c
index 61aa10fb..1ff6776b 100644
--- a/src/chgpasswd.c
+++ b/src/chgpasswd.c
@@ -198,19 +198,19 @@ static void process_flags (int argc, char **argv)
}
#if defined(USE_SHA_CRYPT)
if ( ( ((0 == strcmp (crypt_method, "SHA256")) || (0 == strcmp (crypt_method, "SHA512")))
- && (-1 == getlong(optarg, &sha_rounds)))) {
+ && (-1 == str2sl(&sha_rounds, optarg)))) {
bad_s = 1;
}
#endif /* USE_SHA_CRYPT */
#if defined(USE_BCRYPT)
if (( (0 == strcmp (crypt_method, "BCRYPT"))
- && (-1 == getlong(optarg, &bcrypt_rounds)))) {
+ && (-1 == str2sl(&bcrypt_rounds, optarg)))) {
bad_s = 1;
}
#endif /* USE_BCRYPT */
#if defined(USE_YESCRYPT)
if (( (0 == strcmp (crypt_method, "YESCRYPT"))
- && (-1 == getlong(optarg, &yescrypt_cost)))) {
+ && (-1 == str2sl(&yescrypt_cost, optarg)))) {
bad_s = 1;
}
#endif /* USE_YESCRYPT */
diff --git a/src/chpasswd.c b/src/chpasswd.c
index 2e865e90..79880f56 100644
--- a/src/chpasswd.c
+++ b/src/chpasswd.c
@@ -193,19 +193,19 @@ static void process_flags (int argc, char **argv)
bad_s = 0;
#if defined(USE_SHA_CRYPT)
if ((IS_CRYPT_METHOD("SHA256") || IS_CRYPT_METHOD("SHA512"))
- && (-1 == getlong(optarg, &sha_rounds))) {
+ && (-1 == str2sl(&sha_rounds, optarg))) {
bad_s = 1;
}
#endif /* USE_SHA_CRYPT */
#if defined(USE_BCRYPT)
if (IS_CRYPT_METHOD("BCRYPT")
- && (-1 == getlong(optarg, &bcrypt_rounds))) {
+ && (-1 == str2sl(&bcrypt_rounds, optarg))) {
bad_s = 1;
}
#endif /* USE_BCRYPT */
#if defined(USE_YESCRYPT)
if (IS_CRYPT_METHOD("YESCRYPT")
- && (-1 == getlong(optarg, &yescrypt_cost))) {
+ && (-1 == str2sl(&yescrypt_cost, optarg))) {
bad_s = 1;
}
#endif /* USE_YESCRYPT */
diff --git a/src/faillog.c b/src/faillog.c
index 689b1fba..77c25b8a 100644
--- a/src/faillog.c
+++ b/src/faillog.c
@@ -547,7 +547,7 @@ int main (int argc, char **argv)
usage (E_SUCCESS);
/*@notreached@*/break;
case 'l':
- if (getlong(optarg, &fail_locktime) == -1) {
+ if (str2sl(&fail_locktime, optarg) == -1) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
@@ -559,7 +559,7 @@ int main (int argc, char **argv)
{
long lmax;
- if ( (getlong(optarg, &lmax) == -1)
+ if ( (str2sl(&lmax, optarg) == -1)
|| ((long)(short) lmax != lmax)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
@@ -576,7 +576,7 @@ int main (int argc, char **argv)
case 'R': /* no-op, handled in process_root_flag () */
break;
case 't':
- if (getlong(optarg, &days) == -1) {
+ if (str2sl(&days, optarg) == -1) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
diff --git a/src/lastlog.c b/src/lastlog.c
index f5c42be4..3914b72b 100644
--- a/src/lastlog.c
+++ b/src/lastlog.c
@@ -328,7 +328,7 @@ int main (int argc, char **argv)
case 'b':
{
unsigned long inverse_days;
- if (getulong(optarg, &inverse_days) == -1) {
+ if (str2ul(&inverse_days, optarg) == -1) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
@@ -356,7 +356,7 @@ int main (int argc, char **argv)
case 't':
{
unsigned long days;
- if (getulong(optarg, &days) == -1) {
+ if (str2ul(&days, optarg) == -1) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
diff --git a/src/newusers.c b/src/newusers.c
index 4f667771..0705b579 100644
--- a/src/newusers.c
+++ b/src/newusers.c
@@ -674,19 +674,19 @@ static void process_flags (int argc, char **argv)
}
#if defined(USE_SHA_CRYPT)
if ( ( ((0 == strcmp (crypt_method, "SHA256")) || (0 == strcmp (crypt_method, "SHA512")))
- && (-1 == getlong(optarg, &sha_rounds)))) {
+ && (-1 == str2sl(&sha_rounds, optarg)))) {
bad_s = 1;
}
#endif /* USE_SHA_CRYPT */
#if defined(USE_BCRYPT)
if (( (0 == strcmp (crypt_method, "BCRYPT"))
- && (-1 == getlong(optarg, &bcrypt_rounds)))) {
+ && (-1 == str2sl(&bcrypt_rounds, optarg)))) {
bad_s = 1;
}
#endif /* USE_BCRYPT */
#if defined(USE_YESCRYPT)
if (( (0 == strcmp (crypt_method, "YESCRYPT"))
- && (-1 == getlong(optarg, &yescrypt_cost)))) {
+ && (-1 == str2sl(&yescrypt_cost, optarg)))) {
bad_s = 1;
}
#endif /* USE_YESCRYPT */
diff --git a/src/passwd.c b/src/passwd.c
index df566fcc..2999a3c8 100644
--- a/src/passwd.c
+++ b/src/passwd.c
@@ -801,7 +801,7 @@ int main (int argc, char **argv)
usage (E_SUCCESS);
/*@notreached@*/break;
case 'i':
- if ( (getlong(optarg, &inact) == -1)
+ if ( (str2sl(&inact, optarg) == -1)
|| (inact < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
@@ -820,7 +820,7 @@ int main (int argc, char **argv)
anyflag = true;
break;
case 'n':
- if ( (getlong(optarg, &age_min) == -1)
+ if ( (str2sl(&age_min, optarg) == -1)
|| (age_min < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
@@ -855,7 +855,7 @@ int main (int argc, char **argv)
anyflag = true;
break;
case 'w':
- if ( (getlong(optarg, &warn) == -1)
+ if ( (str2sl(&warn, optarg) == -1)
|| (warn < -1)) {
(void) fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
@@ -866,7 +866,7 @@ int main (int argc, char **argv)
anyflag = true;
break;
case 'x':
- if ( (getlong(optarg, &age_max) == -1)
+ if ( (str2sl(&age_max, optarg) == -1)
|| (age_max < -1)) {
(void) fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
diff --git a/src/useradd.c b/src/useradd.c
index 5f5cdfca..ec21814c 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -416,7 +416,7 @@ static void get_defaults (void)
* Default Password Inactive value
*/
else if (MATCH (buf, DINACT)) {
- if ( (getlong(ccp, &def_inactive) == -1)
+ if ( (str2sl(&def_inactive, ccp) == -1)
|| (def_inactive < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
@@ -1302,7 +1302,7 @@ static void process_flags (int argc, char **argv)
eflg = true;
break;
case 'f':
- if ( (getlong(optarg, &def_inactive) == -1)
+ if ( (str2sl(&def_inactive, optarg) == -1)
|| (def_inactive < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
diff --git a/src/usermod.c b/src/usermod.c
index c11e275e..0fcf0325 100644
--- a/src/usermod.c
+++ b/src/usermod.c
@@ -1062,7 +1062,7 @@ static void process_flags (int argc, char **argv)
eflg = true;
break;
case 'f':
- if ( (getlong(optarg, &user_newinactive) == -1)
+ if ( (str2sl(&user_newinactive, optarg) == -1)
|| (user_newinactive < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),