logger: fix -i=ppid

For short options (-i) the optional argument contains '='.

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2014-07-29 11:49:00 +02:00
parent 852feb7299
commit e598686d3c
1 changed files with 6 additions and 2 deletions

View File

@ -592,9 +592,13 @@ int main(int argc, char **argv)
case 'i': /* log process id also */
ctl.logflags |= LOG_PID;
if (optarg) {
if (!strcmp(optarg, "ppid"))
const char *p = optarg;
if (*p == '=')
p++;
if (!strcmp(p, "ppid"))
ctl.ppid = 1;
else if (!strcmp(optarg, "pid"))
else if (!strcmp(p, "pid"))
ctl.ppid = 0;
else
warnx(_("ignoring unknown option argument: %s"), optarg);