From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, tomoki.sekiyama.qu@hitachi.com,
lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH 06/12] qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set()
Date: Tue, 8 Jan 2013 17:00:03 -0600 [thread overview]
Message-ID: <1357686009-13139-7-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1357686009-13139-1-git-send-email-mdroth@linux.vnet.ibm.com>
From: Luiz Capitulino <lcapitulino@redhat.com>
Convert them to error_setg_errno().
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
qga/commands-posix.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index f7b85b2..9ad2891 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -433,7 +433,6 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
struct FsMount *mount;
Error *local_err = NULL;
int fd;
- char err_msg[512];
slog("guest-fsfreeze called");
@@ -450,9 +449,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
QTAILQ_FOREACH(mount, &mounts, next) {
fd = qemu_open(mount->dirname, O_RDONLY);
if (fd == -1) {
- sprintf(err_msg, "failed to open %s, %s", mount->dirname,
- strerror(errno));
- error_set(err, QERR_QGA_COMMAND_FAILED, err_msg);
+ error_setg_errno(err, errno, "failed to open %s", mount->dirname);
goto error;
}
@@ -468,9 +465,8 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
ret = ioctl(fd, FIFREEZE);
if (ret == -1) {
if (errno != EOPNOTSUPP) {
- sprintf(err_msg, "failed to freeze %s, %s",
- mount->dirname, strerror(errno));
- error_set(err, QERR_QGA_COMMAND_FAILED, err_msg);
+ error_setg_errno(err, errno, "failed to freeze %s",
+ mount->dirname);
close(fd);
goto error;
}
--
1.7.9.5
next prev parent reply other threads:[~2013-01-08 23:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 22:59 [Qemu-devel] [PULL 0/12] qemu-ga: error handling improvements and fsfreeze hooks Michael Roth
2013-01-08 22:59 ` [Qemu-devel] [PATCH 01/12] qemu-ga: guest_file_handle_find(): take an Error argument Michael Roth
2013-01-08 22:59 ` [Qemu-devel] [PATCH 02/12] qemu-ga: qmp_guest_file_close(): fix fclose() error check Michael Roth
2013-01-08 23:00 ` [Qemu-devel] [PATCH 03/12] qemu-ga: qmp_guest_file_*: improve error reporting Michael Roth
2013-01-08 23:00 ` [Qemu-devel] [PATCH 04/12] qemu-ga: qmp_guest_shutdown(): " Michael Roth
2013-01-08 23:00 ` [Qemu-devel] [PATCH 05/12] qemu-ga: build_fs_mount_list(): take an Error argument Michael Roth
2013-01-08 23:00 ` Michael Roth [this message]
2013-01-08 23:00 ` [Qemu-devel] [PATCH 07/12] qemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set() Michael Roth
2013-01-08 23:00 ` [Qemu-devel] [PATCH 08/12] qemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() " Michael Roth
2013-01-08 23:00 ` [Qemu-devel] [PATCH 09/12] qemu-ga: bios_supports_mode(): improve error reporting Michael Roth
2013-01-08 23:00 ` [Qemu-devel] [PATCH 10/12] qemu-ga: guest_suspend(): " Michael Roth
2013-01-08 23:00 ` [Qemu-devel] [PATCH 11/12] qemu-ga: execute hook to quiesce the guest on fsfreeze-freeze/thaw Michael Roth
2013-01-09 21:02 ` Blue Swirl
2013-01-10 11:17 ` Luiz Capitulino
2013-01-08 23:00 ` [Qemu-devel] [PATCH 12/12] qemu-ga: sample fsfreeze hooks Michael Roth
2013-01-09 17:01 ` [Qemu-devel] [PULL 0/12] qemu-ga: error handling improvements and " Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357686009-13139-7-git-send-email-mdroth@linux.vnet.ibm.com \
--to=mdroth@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tomoki.sekiyama.qu@hitachi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).