[systemd-devel] [PATCH] use "Out of memory." consistantly (or with "\n")

Lennart Poettering lennart at poettering.net
Wed Aug 8 10:09:54 PDT 2012


On Wed, 08.08.12 19:06, Kay Sievers (kay at vrfy.org) wrote:

> 
> On Wed, Aug 8, 2012 at 7:02 PM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Mon, 06.08.12 11:43, shawn (shawnlandden at gmail.com) wrote:
> >
> >> -                case '?':
> >> -                        return -EINVAL;
> >> -
> >>                  default:
> >> -                        log_error("Unknown option code %c", c);
> >> +                        log_error("Unknown option code '%c'", c);
> >>                          return -EINVAL;
> >>                  }
> >
> > Hmm, but this would result in one message by getopt() itself and one by
> > us in case the user uses an unknown switch, no?
> >
> > I'd like to turn off that getopt() internal message, but I am not sure
> > there is a way....
> 
> leading : in optstring?

Nah, that just changes whether '?' is returned as error char.

But apparently "opterr = 0" has the desired effect. We probably should
use that in all our tools that use getopt...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list