Created attachment 15959 [details]
When I run the unit tests for socket_wrapper, a bunch of echo_srv processes are left running in the background.
The torture_teardown_echo_srv function reads a PID value from a file, and truncates the value to 16-bits before passing it to the kill() function.
On Linux, pid_t is a 32-bit type. On my system, /proc/sys/kernel/pid_max is set to 4194304. This means the kernel will generate PID values larger than the maximum 16-bit value (65535).
Attached is a patch to avoid truncating the PID values.
This does remove the bounds checking from the code. However, figuring out the maximum value a pid_t can hold in a portable way is a bit ugly. The input data is under our control anyway, so I am choosing to ignore the possibility of an over-sized PID in the pidfile.
Thank you very much for the bug report and patch!
Could you please create a Merge Request at: https://gitlab.com/cwrap/socket_wrapper
(In reply to Andreas Schneider from comment #1)
This has been fixed upstream.
Thank you very much for your contribution!