qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] qemu-ga: Remove unreachable code after g_error
Date: Mon, 03 Sep 2012 19:02:20 +0200	[thread overview]
Message-ID: <5044E29C.1030802@weilnetz.de> (raw)
In-Reply-To: <20120903134920.2dff4a3d@doriath.home>

Am 03.09.2012 18:49, schrieb Luiz Capitulino:
> On Sat,  1 Sep 2012 09:34:15 +0200
> Stefan Weil <sw@weilnetz.de> wrote:
>
>> Report from smatch:
>> qemu-ga.c:117 register_signal_handlers(11) info: ignoring unreachable code.
>> qemu-ga.c:122 register_signal_handlers(16) info: ignoring unreachable code.
>>
>> g_error calls abort which terminates the program.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>>   qemu-ga.c |    2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/qemu-ga.c b/qemu-ga.c
>> index 7623079..b747470 100644
>> --- a/qemu-ga.c
>> +++ b/qemu-ga.c
>> @@ -114,12 +114,10 @@ static gboolean register_signal_handlers(void)
>>       ret = sigaction(SIGINT, &sigact, NULL);
>>       if (ret == -1) {
>>           g_error("error configuring signal handler: %s", strerror(errno));
>> -        return false;
> Good catch, but we should really drop g_error() usage as qemu-ga will not
> fail gracefully otherwise (will leak the pidfile, for example). We either
> just drop g_error() or replace it by fprintf().

Isn't that a classical case of an error which should never occur,
something which could also be handled by an assert statement?

I don't expect a graceful exit after such errors. If they occur,
that's something which must be fixed in the code.

When I read the documentation of sigaction, I don't see how
it could fail with the given function arguments.

Therefore I'd apply the patch as it is.

Regards,

- sw



  reply	other threads:[~2012-09-03 17:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-01  7:34 [Qemu-trivial] [PATCH] qemu-ga: Remove unreachable code after g_error Stefan Weil
2012-09-03 16:49 ` [Qemu-trivial] [Qemu-devel] " Luiz Capitulino
2012-09-03 17:02   ` Stefan Weil [this message]
2012-09-03 17:57     ` Luiz Capitulino
2012-09-22 15:25 ` Stefan Hajnoczi

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=5044E29C.1030802@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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).