]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
logger: fix -i=ppid
authorKarel Zak <kzak@redhat.com>
Tue, 29 Jul 2014 09:49:00 +0000 (11:49 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 29 Jul 2014 09:49:00 +0000 (11:49 +0200)
For short options (-i) the optional argument contains '='.

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/logger.c

index af65af20471f155ee1a1e090950e3eb004a941d1..a9d21884fdb84151a978f56b560d9e1f0b02b328 100644 (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);