]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
nsenter: fix compiler warning [-Wuninitialized]
authorKarel Zak <kzak@redhat.com>
Tue, 28 Nov 2017 09:53:35 +0000 (10:53 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 14 Dec 2017 14:42:15 +0000 (15:42 +0100)
sys-utils/nsenter.c: In function ‘is_same_namespace’:
sys-utils/nsenter.c:170:2: warning: ‘b_ino’ may be used uninitialized in this function [-Wuninitialized]
sys-utils/nsenter.c:170:2: warning: ‘a_ino’ may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/nsenter.c

index 9c452c1d145e3cfbaf2ac559f34960c0813a1408..ec50cb3307d679e23e431759b6db74689591f144 100644 (file)
@@ -157,7 +157,7 @@ static int get_ns_ino(const char *path, ino_t *ino)
 static int is_same_namespace(pid_t a, pid_t b, const char *type)
 {
        char path[PATH_MAX];
-       ino_t a_ino, b_ino;
+       ino_t a_ino = 0, b_ino = 0;
 
        snprintf(path, sizeof(path), "/proc/%u/%s", a, type);
        if (get_ns_ino(path, &a_ino) != 0)