[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH 3/3] platform: fix missing sigisemptyset
From: walter harms <wharms () bfs ! de>
Date: 2013-12-01 15:30:53
Message-ID: 529B562D.1040809 () bfs ! de
[Download RAW message or body]
mea culpa,
missread the code
re,
wh
Am 27.11.2013 16:57, schrieb Daniel Borca:
> Walter,
>
> First, there's no memcopy [sic] in that code.
>
> Second, memcmp returns an int.
>
> Third, even if there was a memcopy [sic] returning a pointer,
> you failed to notice the ! aka logical not. Now, the result
> of !p (where p is a pointer) will not be a pointer.
>
> http://c-faq.com/null/ptrtest.html and http://c-faq.com/bool/bool2.html
>
> That is, !p will always be either 0 or 1, and. nothing. else.
> At least on any C compiler that's even slightly relevant.
>
> walter harms wrote:
>>
>>
>> Am 27.11.2013 15:21, schrieb Denys Vlasenko:
>>> On Wed, Nov 27, 2013 at 2:46 AM, Rich Felker<dalias@aerifal.cx> wrote:
>>>> On Tue, Nov 26, 2013 at 10:01:36PM +0200, Daniel Borca wrote:
>>>>> +#ifndef HAVE_SIGISEMPTYSET
>>>>> +int sigisemptyset(sigset_t *set)
>>>>> +{
>>>>> + sigset_t empty;
>>>>> + int ret = sigemptyset(&empty);
>>>>> + if (ret == 0) {
>>>>> + ret = !memcmp(&empty, set, sizeof(sigset_t));
>>>>> + }
>>>>> + return ret;
>>>>> +}
>>>>> +#endif
>>>>
>>>> This is not a suitable fallback implementation. It's not needed on
>>>> musl (we provide sigisemptyset), but if this version were used, it
>>>> would give the wrong results, because musl's sigemptyset only fills
>>>> the first _NSIG-1 bits and ignores the remaining ~900 bits of junk in
>>>> sigset_t.
>>>
>>> Why does musl use such pointlessly huge sigset_t?
>>
>>
>> i would expect a warning here. ret is int and memcopy returns (void *).
>> This makes int=void*.
>>
>> re,
>> wh
>
> -dborca
>
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic