Re: [hackers] [PATCH][sbase] find: fix flag setting

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Tue, 25 Sep 2018 08:44:39 +0200

On Mon, Sep 24, 2018 at 10:03 PM Michael Forney <mforney_AT_mforney.org> wrote:
> On 7/8/18, Silvan Jegen <s.jegen_AT_gmail.com> wrote:
> > Heyho
> >
> > Found this when running smatch on sbase.
>
> The current code is correct. -H should turn on gflags.h, and turn off
> gflags.l. POSIX says each flag should override the other. I agree that
> the current code is a little confusing.

Yes, you are right. Smatch and me got confused. In my case it was
probably because I
didn't know that assignments in C return the assigned value.


> It would probably be clearer as
>
> case 'H': gflags.h = 1; gflags.l = 0; break;
> case 'L': gflags.h = 0; gflags.l = 1; break;

I also think this would be clearer and shorter.

The current code is correct though so maybe it's not worth to send a patch.

Thanks for having a look!


Cheers,

Silvan
Received on Tue Sep 25 2018 - 08:44:39 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 25 2018 - 08:48:24 CEST