aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2024-04-18 09:08:37 +0200
committerKarel Zak <kzak@redhat.com>2024-04-18 09:08:37 +0200
commit493f50e95508ee67d8e316e96b26fd86e5866303 (patch)
treef078f2e560dd2561d9b2bb10b1337895b1770244
parentf9c1fa2935817da26bfe7ba7efd9e389ddda0e05 (diff)
parent82af9ab04fd31eef71f207d344fbf893a6ef4765 (diff)
downloadutil-linux-493f50e95508ee67d8e316e96b26fd86e5866303.tar.gz
Merge branch 'PR/from-coverity' of github.com:karelzak/util-linux-work
* 'PR/from-coverity' of github.com:karelzak/util-linux-work: lslocks: remove deadcode [coverity scan] hardlink: use xcalloc rather than xmalloc
-rw-r--r--misc-utils/hardlink.c2
-rw-r--r--misc-utils/lslocks.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/misc-utils/hardlink.c b/misc-utils/hardlink.c
index 89046a9f75..5631662427 100644
--- a/misc-utils/hardlink.c
+++ b/misc-utils/hardlink.c
@@ -508,7 +508,7 @@ static int cmp_xattr_name_ptrs(const void *ptr1, const void *ptr2)
*/
static const char **get_sorted_xattr_name_table(const char *names, int n)
{
- const char **table = xmalloc(n * sizeof(char *));
+ const char **table = xcalloc(n, sizeof(char *));
int i;
for (i = 0; i < n; i++) {
diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c
index 176173f211..05784788cd 100644
--- a/misc-utils/lslocks.c
+++ b/misc-utils/lslocks.c
@@ -221,7 +221,6 @@ static char *get_filename_sz(ino_t inode, pid_t lock_pid, size_t *size)
struct stat sb;
struct dirent *dp;
DIR *dirp;
- size_t sz;
int fd;
char path[PATH_MAX] = { 0 },
sym[PATH_MAX] = { 0 }, *ret = NULL;
@@ -241,7 +240,7 @@ static char *get_filename_sz(ino_t inode, pid_t lock_pid, size_t *size)
if (!(dirp = opendir(path)))
return NULL;
- if ((sz = strlen(path)) >= (sizeof(path) - 2))
+ if (strlen(path) >= (sizeof(path) - 2))
goto out;
if ((fd = dirfd(dirp)) < 0 )