From: Paul Eggert Date: Sun, 18 Sep 2022 02:41:15 +0000 (-0700) Subject: kill: port to picky-conversion hosts X-Git-Tag: v9.2~138 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9062704bf8d3b75f73272bb2a8d6539568933e57;p=thirdparty%2Fcoreutils.git kill: port to picky-conversion hosts * src/kill.c (send_signals): Don’t rely on conversion overflow being silent. --- diff --git a/src/kill.c b/src/kill.c index be01b2bf4c..33e602dcdc 100644 --- a/src/kill.c +++ b/src/kill.c @@ -199,9 +199,10 @@ send_signals (int signum, char *const *argv) { char *endp; intmax_t n = (errno = 0, strtoimax (arg, &endp, 10)); - pid_t pid = n; + pid_t pid; - if (errno == ERANGE || pid != n || arg == endp || *endp) + if (errno == ERANGE || INT_ADD_WRAPV (n, 0, &pid) + || arg == endp || *endp) { error (0, 0, _("%s: invalid process id"), quote (arg)); status = EXIT_FAILURE;