diff options
author | Mike Gilbert <floppym@gentoo.org> | 2020-05-07 23:28:50 -0400 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2020-05-14 12:46:13 +0200 |
commit | bbc1d654cae9197fa3782e8ea8e1aaa9fdf0cfb0 (patch) | |
tree | 6eac344a0ef4ccd11fd2244f112c1158958952e1 /tests | |
parent | f6a10e2a4a34662b11430aecf3eea7b6b3bf844f (diff) | |
download | socket_wrapper-bbc1d654cae9197fa3782e8ea8e1aaa9fdf0cfb0.tar.gz socket_wrapper-bbc1d654cae9197fa3782e8ea8e1aaa9fdf0cfb0.tar.xz socket_wrapper-bbc1d654cae9197fa3782e8ea8e1aaa9fdf0cfb0.zip |
tests: do not truncate pid to 16 bits
On Linux, pid_t is a 32-bit type, and the kernel permits pids up to 22
bits in length.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14373
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/torture.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/torture.c b/tests/torture.c index e55ebcf..595f504 100644 --- a/tests/torture.c +++ b/tests/torture.c @@ -255,8 +255,7 @@ void torture_teardown_socket_dir(void **state) void torture_teardown_echo_srv(void **state) { struct torture_state *s = *state; - char buf[8] = {0}; - long int tmp; + char buf[12] = {0}; /* -2147483648 + null byte */ ssize_t rc; pid_t pid; int fd; @@ -277,13 +276,12 @@ void torture_teardown_echo_srv(void **state) buf[sizeof(buf) - 1] = '\0'; - tmp = strtol(buf, NULL, 10); - if (tmp == 0 || tmp > 0xFFFF || errno == ERANGE) { + errno = 0; + pid = strtol(buf, NULL, 10); + if (pid == 0 || errno != 0) { goto done; } - pid = (pid_t)(tmp & 0xFFFF); - for (count = 0; count < 10; count++) { /* Make sure the daemon goes away! */ kill(pid, SIGTERM); |