summaryrefslogtreecommitdiffstats
path: root/misc-utils/lslocks.c
diff options
context:
space:
mode:
authorKarel Zak2018-04-13 11:22:21 +0200
committerKarel Zak2018-04-13 11:22:21 +0200
commit2aaf56c45f7603f7e24e99d1678e035a5cc50e10 (patch)
tree8138bfeecc22a0e46d924b45b3433c836bcfffc4 /misc-utils/lslocks.c
parentlibblkid: (hfs) check allocation size (diff)
downloadkernel-qcow2-util-linux-2aaf56c45f7603f7e24e99d1678e035a5cc50e10.tar.gz
kernel-qcow2-util-linux-2aaf56c45f7603f7e24e99d1678e035a5cc50e10.tar.xz
kernel-qcow2-util-linux-2aaf56c45f7603f7e24e99d1678e035a5cc50e10.zip
lslocks: add info about OFD
It seems users are confused by PID -1 and missing path. This patch add more information about OFD locks to the man page and "undefined" to the COMMAND column. References: http://austingroupbugs.net/view.php?id=768 Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1527102 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lslocks.c')
-rw-r--r--misc-utils/lslocks.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c
index a1a7ab676..fe15ff530 100644
--- a/misc-utils/lslocks.c
+++ b/misc-utils/lslocks.c
@@ -276,12 +276,15 @@ static int get_local_locks(struct list_head *locks)
case 4: /* PID */
/*
* If user passed a pid we filter it later when adding
- * to the list, no need to worry now.
+ * to the list, no need to worry now. OFD locks use -1 PID.
*/
l->pid = strtos32_or_err(tok, _("failed to parse pid"));
- l->cmdname = proc_get_command_name(l->pid);
- if (!l->cmdname)
- l->cmdname = xstrdup(_("(unknown)"));
+ if (l->pid > 0) {
+ l->cmdname = proc_get_command_name(l->pid);
+ if (!l->cmdname)
+ l->cmdname = xstrdup(_("(unknown)"));
+ } else
+ l->cmdname = xstrdup(_("(undefined)"));
break;
case 5: /* device major:minor and inode number */