lslocks: check errno after strto..()

Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-06-21 15:33:36 +02:00
parent f1de6d6526
commit 93d01a6233
1 changed files with 3 additions and 1 deletions

View File

@ -192,8 +192,10 @@ static char *get_filename_sz(ino_t inode, pid_t lock_pid, size_t *size)
!strcmp(dp->d_name, ".."))
continue;
errno = 0;
/* care only for numerical descriptors */
if (!strtol(dp->d_name, (char **) NULL, 10))
if (!strtol(dp->d_name, (char **) NULL, 10) || errno)
continue;
if (!fstatat(fd, dp->d_name, &sb, 0)