X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/9c8dbb1bfa2808826bc9154227521315d4c0c5ee..6bcd370951a5be83eb2a8846e63e4694ff798cc5:/openbsd-compat/bsd-waitpid.c diff --git a/openbsd-compat/bsd-waitpid.c b/openbsd-compat/bsd-waitpid.c index 0bf4c7cd..40e6ffaa 100644 --- a/openbsd-compat/bsd-waitpid.c +++ b/openbsd-compat/bsd-waitpid.c @@ -1,4 +1,6 @@ /* + * Copyright (c) 2000 Ben Lindstrom. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -36,13 +38,16 @@ waitpid(int pid, int *stat_loc, int options) if (pid <= 0) { if (pid != -1) { errno = EINVAL; - return -1; + return (-1); } - pid = 0; /* wait4() wants pid=0 for indiscriminate wait. */ + /* wait4() wants pid=0 for indiscriminate wait. */ + pid = 0; } wait_pid = wait4(pid, &statusp, options, NULL); - stat_loc = (int *)statusp.w_status; - return wait_pid; + if (stat_loc) + *stat_loc = (int) statusp.w_status; + + return (wait_pid); } #endif /* !HAVE_WAITPID */