Fix waitpid return value
@@ -265,8 +265,11 @@ static int sys_waitpid(thread_t *td, syscall_args_t *args) {
int res = do_waitpid(pid, &status, options);
if (res < 0)
return res;
- if (status_p != NULL)
- res = copyout_s(status, status_p);
+ if (status_p != NULL) {
+ int error = copyout_s(status, status_p);
+ if (error)
+ return error;
+ }
return res;
}
