On Wednesday 26 January 2011 17:45:26 you wrote:
> Selon Tito <[email protected]>:
>
> > On Wednesday 26 January 2011 15:24:17 Gilles Espinasse wrote:
> > > Selon Tito <[email protected]>:
> > >
> > > > Hi,
> > > > in id.c maybe I've found a minor bug.
> > > >
> > > > } else if (n < 0) { /* error in get_groups() */
> > > > - if (!ENABLE_DESKTOP)
> > > > + if (ENABLE_DESKTOP)
> > > > bb_error_msg_and_die("can't get
> > > > groups");
> > > > else
> > > > return EXIT_FAILURE;
> > > > }
> > > >
> > > >
> > > > ciao,
> > > > Tito
> > >
> > >
> > > Another issue.
> > >
> > > Should really 'return EXIT_FAILURE' depend of ENABLE_DESKTOP?
> > >
> > >
> > > Gilles
> > >
> >
> > My idea was ENABLE_DESKTOP = bloat so verbose error message
> > !ENABLE_DESKTOP= minimal so only return error to shell
> >
> > Maybe I'm overlooking something obvious?
> > Ciao,
> > Tito
> >
> >
> I miss the _and_die part and think that was bad to have an exit status
> depending
> of ENABLE_DESKTOP.
>
> I don't know if size would be better or worse without the else but exit status
> should remain inchanged.
>
> A few lines above in print_common function, there is
> if (option_mask32) {
> if (ENABLE_DESKTOP)
> bb_error_msg("unknown ID %u", id);
> return EXIT_FAILURE;
> }
> which is a different way (no else, no _and_die) to have a similar handling
> (but
> there in a function)
>
>
> Gilles
Hi,
the older code was done with compiler dead code optimization in mind
and should in fact give more or less the same code as above in the end:
if (ENABLE_DESKTOP)
bb_error_msg_and_die("can't get groups");
else
return EXIT_FAILURE;
as in
if (0)
<=
bb_error_msg_and_die("can't get groups"); <= this is dead
code
else
<=
return EXIT_FAILURE;
or in
if (1)
<=
bb_error_msg_and_die("can't get groups");
else
<= this is dead code and bb_error_msg_and_die returns EXIT_FAILURE
return EXIT_FAILURE; <=
Ciao,
Tito
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox