nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] interrupting an open() does work with gcc when flags ar


From: Benno Schulenberg
Subject: Re: [Nano-devel] interrupting an open() does work with gcc when flags are zeroed
Date: Thu, 23 May 2019 19:15:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Op 23-05-19 om 14:26 schreef Brand Huntsman:
> On Thu, 23 May 2019 11:28:04 +0200 Benno Schulenberg <address@hidden>
> wrote:
>> With attached demo patch, ^C will interrupt the open() call for me, *when* I
>> use clang or tcc as compiler.  But with gcc... nothing happens.  :|
> 
> newaction.sa_handler = noop; newaction.sa_flags = 0;
> 
> The patch segfaults without the sa_flags line, because it contains garbage. ^C
> now works fine in gcc 8.3 when properly set to zero.

Yeah, I started suspecting an uninitialized value when moving the
declaration of oldaction and newaction caused different behavior
with tcc.

> It might be a good idea to zero the flags for other code that uses
> sigaction().

Will do.  (I thought that the initial 'sigaction(SIGINT, NULL, &newaction)'
that is used in other places would initialize the whole struct, but this
appears not to be the case.)

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]