diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2012-11-27 11:02:00 -0200 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2013-01-08 16:38:11 -0600 |
commit | 617fbbc13219d26dd71d100d83d617ec8acf5e2d (patch) | |
tree | d8990d4fbeb86000c872f826bc10c63c95f200b0 | |
parent | 261551d1cc3a830e9623971dffa8033b216f1d63 (diff) |
qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set()
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>
-rw-r--r-- | qga/commands-posix.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c index f7b85b284c..9ad2891d77 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; } |