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>
This commit is contained in:
parent
261551d1cc
commit
617fbbc132
|
@ -433,7 +433,6 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
|
||||||
struct FsMount *mount;
|
struct FsMount *mount;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
char err_msg[512];
|
|
||||||
|
|
||||||
slog("guest-fsfreeze called");
|
slog("guest-fsfreeze called");
|
||||||
|
|
||||||
|
@ -450,9 +449,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
|
||||||
QTAILQ_FOREACH(mount, &mounts, next) {
|
QTAILQ_FOREACH(mount, &mounts, next) {
|
||||||
fd = qemu_open(mount->dirname, O_RDONLY);
|
fd = qemu_open(mount->dirname, O_RDONLY);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
sprintf(err_msg, "failed to open %s, %s", mount->dirname,
|
error_setg_errno(err, errno, "failed to open %s", mount->dirname);
|
||||||
strerror(errno));
|
|
||||||
error_set(err, QERR_QGA_COMMAND_FAILED, err_msg);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,9 +465,8 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
|
||||||
ret = ioctl(fd, FIFREEZE);
|
ret = ioctl(fd, FIFREEZE);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
if (errno != EOPNOTSUPP) {
|
if (errno != EOPNOTSUPP) {
|
||||||
sprintf(err_msg, "failed to freeze %s, %s",
|
error_setg_errno(err, errno, "failed to freeze %s",
|
||||||
mount->dirname, strerror(errno));
|
mount->dirname);
|
||||||
error_set(err, QERR_QGA_COMMAND_FAILED, err_msg);
|
|
||||||
close(fd);
|
close(fd);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue