Use wait_for_process() to wait for processes created with simple_exec*

This commit is contained in:
Asanka Herath
2009-08-26 12:58:42 -04:00
committed by Love Hornquist Astrand
parent bf5b934b06
commit 6a88c16dea

View File

@@ -199,7 +199,7 @@ external_passwd_quality (krb5_context context,
fclose(out); fclose(out);
fclose(error); fclose(error);
waitpid(child, &status, 0); wait_for_process(child);
return 1; return 1;
} }
reply[strcspn(reply, "\n")] = '\0'; reply[strcspn(reply, "\n")] = '\0';
@@ -207,12 +207,9 @@ external_passwd_quality (krb5_context context,
fclose(out); fclose(out);
fclose(error); fclose(error);
if (waitpid(child, &status, 0) < 0) { status = wait_for_process(child);
snprintf(message, length, "external program failed: %s", reply);
free(p); if (SE_IS_ERROR(status) || SE_PROCSTATUS(status) != 0) {
return 1;
}
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
snprintf(message, length, "external program failed: %s", reply); snprintf(message, length, "external program failed: %s", reply);
free(p); free(p);
return 1; return 1;