From ffa343fb8259e494287434c537ccd6576a95955d Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <707b9b97153063374d2530e72c49b1499fc21af9.1367947969.git.minovotn@redhat.com> References: <707b9b97153063374d2530e72c49b1499fc21af9.1367947969.git.minovotn@redhat.com> From: Michal Novotny Date: Tue, 7 May 2013 18:37:43 +0200 Subject: [PATCH 037/114] Revert "qemu-ga: guest_suspend(): improve error reporting" This reverts commit eaf50e3cb84534ea99d7774a44a164a12c9d9601. Reverting as asked by Laszlo in message <51892739.2030807@redhat.com> because of the ordering issue (most likely) related to supersed testing. Signed-off-by: Michal Novotny --- qga/commands-posix.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 75643fe..3ffd64f 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -699,9 +699,8 @@ out: static void guest_suspend(const char *pmutils_bin, const char *sysfile_str, Error **err) { - Error *local_err = NULL; char *pmutils_path; - pid_t pid; + pid_t rpid, pid; int status; pmutils_path = g_find_program_in_path(pmutils_bin); @@ -739,29 +738,23 @@ static void guest_suspend(const char *pmutils_bin, const char *sysfile_str, } _exit(EXIT_SUCCESS); - } else if (pid < 0) { - error_setg_errno(err, errno, "failed to create child process"); - goto out; } - ga_wait_child(pid, &status, &local_err); - if (error_is_set(&local_err)) { - error_propagate(err, local_err); - goto out; - } + g_free(pmutils_path); - if (!WIFEXITED(status)) { - error_setg(err, "child process has terminated abnormally"); - goto out; + if (pid < 0) { + goto exit_err; } - if (WEXITSTATUS(status)) { - error_setg(err, "child process has failed to suspend"); - goto out; + do { + rpid = waitpid(pid, &status, 0); + } while (rpid == -1 && errno == EINTR); + if (rpid == pid && WIFEXITED(status) && !WEXITSTATUS(status)) { + return; } -out: - g_free(pmutils_path); +exit_err: + error_set(err, QERR_UNDEFINED_ERROR); } void qmp_guest_suspend_disk(Error **err) -- 1.7.11.7