]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsipc: fix ID parsing, use full time for pretty print
authorKarel Zak <kzak@redhat.com>
Wed, 1 Jul 2015 09:52:25 +0000 (11:52 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 20 Jul 2015 09:48:09 +0000 (11:48 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lsipc.c

index 2cc93aa304554f31bf38955902d7dff39b7f3e3c..a013b0d133f975799d2eccf9bb2fcfaa25998dd9 100644 (file)
@@ -48,7 +48,7 @@ enum {
        TIME_INVALID = 0,
        TIME_SHORT,
        TIME_FULL,
-       TIME_ISO,
+       TIME_ISO
 };
 
 /*
@@ -1061,7 +1061,7 @@ int main(int argc, char *argv[])
        textdomain(PACKAGE);
        atexit(close_stdout);
 
-       ctl->time_mode = TIME_SHORT;
+       ctl->time_mode = 0;
 
        while ((opt = getopt_long(argc, argv, "bceghi:Jmno:PqrstuVz", longopts, NULL)) != -1) {
 
@@ -1072,7 +1072,7 @@ int main(int argc, char *argv[])
                                ctl->bytes = 1;
                                break;
                        case 'i':
-                               id = atoi (optarg);
+                               id = strtos32_or_err(optarg, _("failed to parse IPC identifier"));
                                outmode = OUT_PRETTY;
                                break;
                        case OPT_COLON:
@@ -1179,6 +1179,9 @@ int main(int argc, char *argv[])
        if (global && msg + shm + sem == 0)
                msg = shm = sem = 1;
 
+       if (!ctl->time_mode)
+               ctl->time_mode = outmode == OUT_PRETTY ? TIME_FULL : TIME_SHORT;
+
        if (outmode == OUT_PRETTY && !optarg) {
                /* all columns for lsipc --<RESOURCE> --id <ID> */
                for (ncolumns = 0, i = 0; i < ARRAY_SIZE(coldescs); i++)