From: Jakub Wilk Date: Mon, 3 Jul 2023 10:18:51 +0000 (+0200) Subject: lslocks: don't attempt to open /proc/-1/fd/ X-Git-Tag: v2.40-rc1~348^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=89295e10e6086e1a500faadabafca0bb8d07ea6c;p=thirdparty%2Futil-linux.git lslocks: don't attempt to open /proc/-1/fd/ Signed-off-by: Jakub Wilk --- diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c index ba837d51ad..87ddfdcdc7 100644 --- a/misc-utils/lslocks.c +++ b/misc-utils/lslocks.c @@ -178,6 +178,10 @@ static char *get_filename_sz(ino_t inode, pid_t lock_pid, size_t *size) memset(path, 0, sizeof(path)); memset(sym, 0, sizeof(sym)); + if (lock_pid < 0) + /* pid could be -1 for OFD locks */ + return NULL; + /* * We know the pid so we don't have to * iterate the *entire* filesystem searching