From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdnVM-0000r7-IF for qemu-devel@nongnu.org; Wed, 28 Nov 2012 14:41:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TdnVL-0001Vv-Ex for qemu-devel@nongnu.org; Wed, 28 Nov 2012 14:41:08 -0500 Received: from mail-ia0-f173.google.com ([209.85.210.173]:51931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdnVL-0001Vn-9y for qemu-devel@nongnu.org; Wed, 28 Nov 2012 14:41:07 -0500 Received: by mail-ia0-f173.google.com with SMTP id w21so8550714iac.4 for ; Wed, 28 Nov 2012 11:41:06 -0800 (PST) Sender: fluxion Date: Wed, 28 Nov 2012 13:40:02 -0600 From: mdroth Message-ID: <20121128194002.GH8690@vm> References: <1354021324-31561-1-git-send-email-lcapitulino@redhat.com> <1354021324-31561-7-git-send-email-lcapitulino@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1354021324-31561-7-git-send-email-lcapitulino@redhat.com> Subject: Re: [Qemu-devel] [PATCH 06/10] qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org On Tue, Nov 27, 2012 at 11:02:00AM -0200, Luiz Capitulino wrote: > Convert them to error_setg_errno(). > > Signed-off-by: Luiz Capitulino Reviewed-by: Michael Roth > --- > 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 59bb32d..9325433 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.8.0 >