qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: SeokYeon Hwang <syeon.hwang@samsung.com>, qemu-devel@nongnu.org
Cc: paolo.bonzini@gmail.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH] error: fixed error_set_errno() to deal with a negative type of os_error.
Date: Wed, 05 Nov 2014 09:12:17 +0100	[thread overview]
Message-ID: <5459DBE1.30509@redhat.com> (raw)
In-Reply-To: <1415174992-13246-1-git-send-email-syeon.hwang@samsung.com>

On 2014-11-05 at 09:09, SeokYeon Hwang wrote:
> Negative type of errno like -ERRNO is used a lot by developers. Therefore, error_set_errno() is modified to deal with a negative type of os_error.
> (Negative type is used at pcie_cap_slot_hotplug_common() in hw/pci/pcie.c)
>
> Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
> ---
>   util/error.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/util/error.c b/util/error.c
> index 2ace0d8..5db00c9 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -68,7 +68,7 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class,
>       va_start(ap, fmt);
>       msg1 = g_strdup_vprintf(fmt, ap);
>       if (os_errno != 0) {
> -        err->msg = g_strdup_printf("%s: %s", msg1, strerror(os_errno));
> +        err->msg = g_strdup_printf("%s: %s", msg1, strerror(abs(os_errno)));
>           g_free(msg1);
>       } else {
>           err->msg = msg1;

This is utterly broken and we should fix all callers instead.

...But I like it.

Reviewed-by: Max Reitz <mreitz@redhat.com>

  reply	other threads:[~2014-11-05  8:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05  8:09 [Qemu-devel] [PATCH] error: fixed error_set_errno() to deal with a negative type of os_error SeokYeon Hwang
2014-11-05  8:12 ` Max Reitz [this message]
2014-11-05 10:57   ` Paolo Bonzini
2014-11-05 11:11     ` Max Reitz
2014-11-05 11:19       ` Eric Blake
2014-11-06  4:49         ` Amos Kong
2014-11-05 12:44       ` Paolo Bonzini
2014-11-05 13:13         ` SeokYeon Hwang
2014-11-05 13:29         ` Markus Armbruster
2014-11-06  2:02         ` SeokYeon Hwang
2014-11-06  9:25           ` Markus Armbruster
2014-11-07  2:26             ` SeokYeon Hwang

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=5459DBE1.30509@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=paolo.bonzini@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=syeon.hwang@samsung.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).