From e391eb27c711a5d51f7a5ad92928212fdcb3133a Mon Sep 17 00:00:00 2001 From: Michal Zidek Date: Wed, 3 Apr 2013 17:04:41 +0200 Subject: Check for waitpid failure at wrong place. Coverity bugs. https://fedorahosted.org/sssd/ticket/1865 --- src/tools/tools_util.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/tools/tools_util.c') diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c index 85164c612..1ad5326e3 100644 --- a/src/tools/tools_util.c +++ b/src/tools/tools_util.c @@ -538,12 +538,6 @@ int run_userdel_cmd(struct tools_ctx *tctx) } while((child_pid = waitpid(pid, &status, 0)) > 0) { - if (child_pid == -1) { - DEBUG(1, ("waitpid failed\n")); - ret = errno; - goto done; - } - if (WIFEXITED(status)) { ret = WEXITSTATUS(status); if (ret != 0) { @@ -567,6 +561,11 @@ int run_userdel_cmd(struct tools_ctx *tctx) goto done; } } + if (child_pid == -1) { + DEBUG(SSSDBG_CRIT_FAILURE, ("waitpid failed\n")); + ret = errno; + goto done; + } } ret = EOK; -- cgit