The posixspawn family of functions returns != 0 on error, and the return is an error code that can be passed to strerror(). So check for != 0, not < 0. (Error codes that can be passed to strerror() are in practice > 0!) Rename check_posix to check_posix_spawn too, to make it clear it's only for checking return codes from functions in the posixspawn family.
The normal C runtime functions return a code < 0 on error, and put the error code in errno. Add a check_ret_errno function and call that instead of check_posix for non-spawn functions.
The posixspawn family of functions returns != 0 on error, and the return is an error code that can be passed to strerror(). So check for
!= 0
, not< 0
. (Error codes that can be passed to strerror() are in practice > 0!) Renamecheck_posix
tocheck_posix_spawn
too, to make it clear it's only for checking return codes from functions in the posixspawn family.The normal C runtime functions return a code < 0 on error, and put the error code in errno. Add a check_ret_errno function and call that instead of check_posix for non-spawn functions.