summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2024-09-24 16:17:42 +0100
committerAndrew Clayton <a.clayton@nginx.com>2024-09-25 14:00:33 +0100
commit0e4342fa947fabde643c1482c70a3a3250756570 (patch)
tree983d814ee7485891c549ca6f2e50f4a8eafce3df /pkg
parentac90254870760011203a649ba833445918815703 (diff)
downloadunit-0e4342fa947fabde643c1482c70a3a3250756570.tar.gz
unit-0e4342fa947fabde643c1482c70a3a3250756570.tar.bz2
Re-work nxt_process_check_pid_status() slightly
There has been a long standing clang-analyzer issue in nxt_process_check_pid_status(), well ever since I introduced this function in commit b0e2d9d0a ("Isolation: Switch to fork(2) & unshare(2) on Linux."), It is complaining that there are cases where 'status' could be returned with an undefined or garbage value. Now I'm convinced this can't happen If nxt_process_pipe_timer() returns NXT_OK read(2) the status value If the read(2) failed or if we got NXT_ERROR from nxt_process_pipe_timer(), NXT_OK (0) and NXT_ERROR (-1) are the only possible return values here, then we set status to -1 I don't see a scenario where status is either not set by the read(2) or not set to -1. Now I'm not a fan of initialising variables willy-nilly, however, in this case if we initialise status to -1, then we can simply remove the if (ret <= 0) { check. So it closes this (non-)issue but also provides a little code simplification. NOTE: There is no need to check the return from the read(2) here. We are reading a single byte, we either get it or don't. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'pkg')
0 files changed, 0 insertions, 0 deletions