diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-11-01 00:55:21 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-11-01 00:55:21 +0000 |
commit | ba8e075ad05d2bd70ac29e4929e7ea8bbd09c999 (patch) | |
tree | 594564cc3f683070d2eb497228aa0e18f5987a85 | |
parent | 4cd9f8021c13a823d873aabb16f05aaceac4f369 (diff) |
Fix waitpid() idiom. Noticed by deraadt@
-rw-r--r-- | lib/libc/gen/auth_subr.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/gen/auth_subr.c b/lib/libc/gen/auth_subr.c index 4b3efa798e9..c3a77c58dfe 100644 --- a/lib/libc/gen/auth_subr.c +++ b/lib/libc/gen/auth_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth_subr.c,v 1.31 2007/09/17 07:07:23 moritz Exp $ */ +/* $OpenBSD: auth_subr.c,v 1.32 2007/11/01 00:55:20 millert Exp $ */ /* * Copyright (c) 2000-2002,2004 Todd C. Miller <Todd.Miller@courtesan.com> @@ -887,9 +887,8 @@ auth_call(auth_session_t *as, char *path, ...) _auth_spool(as, pfd[0]); close(pfd[0]); status = 0; - do { - pid = waitpid(pid, &status, 0); - } while (pid < 0 && errno == EINTR); + while (waitpid(pid, &status, 0) == -1 && errno == EINTR) + ; if (pid < 0) { if (errno != ECHILD) { syslog(LOG_ERR, "%s: waitpid: %m", path); |