From c0dc41ab23394e26d6f13d930fe78f01baa8268b 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:49 +0200 Subject: [PATCH 039/114] Revert "qemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set()" This reverts commit 68fc22726d974edc0fe36a9f63ef0a2b68b4a3f9. 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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 70283ac..8994e96 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -562,6 +562,7 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) struct FsMount *mount; int fd; Error *local_err = NULL; + char err_msg[512]; struct fstrim_range r = { .start = 0, .len = -1, @@ -580,7 +581,9 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) QTAILQ_FOREACH(mount, &mounts, next) { fd = qemu_open(mount->dirname, O_RDONLY); if (fd == -1) { - error_setg_errno(err, errno, "failed to open %s", mount->dirname); + sprintf(err_msg, "failed to open %s, %s", mount->dirname, + strerror(errno)); + error_set(err, QERR_QGA_COMMAND_FAILED, err_msg); goto error; } @@ -593,8 +596,9 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) ret = ioctl(fd, FITRIM, &r); if (ret == -1) { if (errno != ENOTTY && errno != EOPNOTSUPP) { - error_setg_errno(err, errno, "failed to trim %s", - mount->dirname); + sprintf(err_msg, "failed to trim %s, %s", + mount->dirname, strerror(errno)); + error_set(err, QERR_QGA_COMMAND_FAILED, err_msg); close(fd); goto error; } -- 1.7.11.7