Commit d2a32ca6 authored by Jakub Jelen's avatar Jakub Jelen Committed by Andreas Schneider

torture: Accept whole pid_t range

Signed-off-by: Jakub Jelen's avatarJakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider's avatarAndreas Schneider <asn@cryptomilk.org>
parent e42307bb
Pipeline #102259763 passed with stage
in 23 minutes and 20 seconds
......@@ -196,6 +196,7 @@ torture_read_pidfile(const char *pidfile)
{
char buf[8] = {0};
long int tmp;
pid_t ret;
ssize_t rc;
int fd;
......@@ -213,11 +214,16 @@ torture_read_pidfile(const char *pidfile)
buf[sizeof(buf) - 1] = '\0';
tmp = strtol(buf, NULL, 10);
if (tmp == 0 || tmp > 0xFFFF || errno == ERANGE) {
if (tmp == 0 || errno == ERANGE) {
return -1;
}
ret = (pid_t)tmp;
/* Check if we are out of pid_t range on this system */
if ((long)ret != tmp) {
return -1;
}
return (pid_t)(tmp & 0xFFFF);
return ret;
}
int torture_terminate_process(const char *pidfile)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment