diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 5268aba1e..800784005 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -743,7 +743,7 @@ int main(int argc, char **argv) } break; case 'O': - offset = strtosize_or_err(optarg, "failed to parse offset"); + offset = strtosize_or_err(optarg, "invalid offset argument"); break; case 'p': lowprobe |= LOWPROBE_SUPERBLOCKS; @@ -757,7 +757,7 @@ int main(int argc, char **argv) show[numtag] = NULL; break; case 'S': - size = strtosize_or_err(optarg, "failed to parse size"); + size = strtosize_or_err(optarg, "invalid size argument"); break; case 't': if (search_type) { diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 2de7164cd..60e85df05 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -368,17 +368,17 @@ main(int argc, char **argv) { day = month = year = 0; switch(argc) { case 3: - day = strtol_or_err(*argv++, _("illegal day value")); + day = strtos32_or_err(*argv++, _("illegal day value")); if (day < 1 || 31 < day) errx(EXIT_FAILURE, _("illegal day value: use 1-%d"), 31); /* FALLTHROUGH */ case 2: - month = strtol_or_err(*argv++, _("illegal month value: use 1-12")); + month = strtos32_or_err(*argv++, _("illegal month value: use 1-12")); if (month < 1 || 12 < month) errx(EXIT_FAILURE, _("illegal month value: use 1-12")); /* FALLTHROUGH */ case 1: - year = strtol_or_err(*argv++, _("illegal year value: use 1-9999")); + year = strtos32_or_err(*argv++, _("illegal year value: use 1-9999")); if (year < 1 || 9999 < year) errx(EXIT_FAILURE, _("illegal year value: use 1-9999")); if (day) { diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index dc01d94ad..1d34696c3 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -1187,8 +1187,7 @@ int main(int argc, char *argv[]) flags |= FL_NOSWAPMATCH; break; case 'w': - timeout = strtol_or_err(optarg, - _("failed to parse timeout")); + timeout = strtos32_or_err(optarg, _("invalid timeout argument")); break; case 'V': printf(UTIL_LINUX_VERSION); diff --git a/misc-utils/kill.c b/misc-utils/kill.c index dc024924c..da7c8abe6 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -245,7 +245,7 @@ int main (int argc, char *argv[]) argc--, argv++; arg = *argv; #ifdef HAVE_SIGQUEUE - sigdata.sival_int = strtol_or_err(arg, _("failed to parse sigval")); + sigdata.sival_int = strtos32_or_err(arg, _("invalid sigval argument")); use_sigval = 1; #endif continue; diff --git a/misc-utils/logger.c b/misc-utils/logger.c index e3b67d2a2..db3469c3d 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -63,7 +63,7 @@ int decode __P((char *, CODE *)); int pencode __P((char *)); static int optd = 0; -static int udpport = 514; +static uint16_t udpport = 514; static int myopenlog(const char *sock) { @@ -86,7 +86,7 @@ myopenlog(const char *sock) { } static int -udpopenlog(const char *servername,int port) { +udpopenlog(const char *servername, uint16_t port) { int fd; struct sockaddr_in s_addr; struct hostent *serverhost; @@ -169,7 +169,6 @@ main(int argc, char **argv) { char *usock = NULL; char *udpserver = NULL; int LogSock = -1; - long tmpport; static const struct option longopts[] = { { "id", no_argument, 0, 'i' }, @@ -225,12 +224,8 @@ main(int argc, char **argv) { udpserver = optarg; break; case 'P': /* change udp port */ - tmpport = strtol_or_err(optarg, - _("failed to parse port number")); - if (tmpport < 0 || 65535 < tmpport) - errx(EXIT_FAILURE, _("port `%ld' out of range"), - tmpport); - udpport = (int) tmpport; + udpport = strtou16_or_err(optarg, + _("invalid port number argument")); break; case 'V': printf(_("%s from %s\n"), program_invocation_short_name, diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c index 13eaaf332..094224de6 100644 --- a/misc-utils/lslocks.c +++ b/misc-utils/lslocks.c @@ -268,7 +268,7 @@ static int get_local_locks(struct list_head *locks) * If user passed a pid we filter it later when adding * to the list, no need to worry now. */ - l->pid = strtol_or_err(tok, _("failed to parse pid")); + l->pid = strtos32_or_err(tok, _("failed to parse pid")); l->cmdname = get_cmdname(l->pid); if (!l->cmdname) l->cmdname = xstrdup(_("(unknown)")); @@ -280,14 +280,14 @@ static int get_local_locks(struct list_head *locks) case 6: /* start */ l->start = !strcmp(tok, "EOF") ? 0 : - strtol_or_err(tok, _("failed to parse start")); + strtou64_or_err(tok, _("failed to parse start")); break; case 7: /* end */ /* replace '\n' character */ tok[strlen(tok)-1] = '\0'; l->end = !strcmp(tok, "EOF") ? 0 : - strtol_or_err(tok, _("failed to parse end")); + strtou64_or_err(tok, _("failed to parse end")); break; default: break; @@ -521,7 +521,7 @@ int main(int argc, char *argv[]) switch(c) { case 'p': - pid = strtol_or_err(optarg, _("cannot parse PID")); + pid = strtos32_or_err(optarg, _("invalid PID argument")); break; case 'o': ncolumns = string_to_idarray(optarg, diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index c751c3ac6..e0ced2f69 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -407,7 +407,7 @@ main(int argc, char **argv) break; case 'o': wp0 = add_offset(wp0, strtosize_or_err(optarg, - _("failed to parse offset")), 1); + _("invalid offset argument")), 1); has_offset++; break; case 'p':