]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lslocks: check errno after strto..()
authorKarel Zak <kzak@redhat.com>
Mon, 21 Jun 2021 13:33:36 +0000 (15:33 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 20 Jul 2021 09:34:53 +0000 (11:34 +0200)
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lslocks.c

index 18922e546868284c8a4e7930464f9fd7a276604f..941ef7f06de1cc639d3e9c7e1d72c585cbf30b58 100644 (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)