]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fixup! lsns: interpolate missing namespaces for converting forests to a tree
authorMasatake YAMATO <yamato@redhat.com>
Thu, 29 Apr 2021 17:44:12 +0000 (02:44 +0900)
committerKarel Zak <kzak@redhat.com>
Mon, 24 May 2021 11:39:53 +0000 (13:39 +0200)
sys-utils/lsns.c

index 8905a13bd1d954e322f60fed6f994ace10937208..ac31c8fd9b933accd8256234598f7cc2a9465d91 100644 (file)
@@ -755,7 +755,7 @@ static struct lsns_namespace *add_namespace_for_nsfd(struct lsns *ls, int fd, in
        return ns;
 }
 
-static void interpolate_missing_namespaces (struct lsns *ls, struct lsns_namespace *orphan, int rela)
+static void interpolate_missing_namespaces(struct lsns *ls, struct lsns_namespace *orphan, int rela)
 {
        const int cmd[MAX_RELA] = {
                [RELA_PARENT] = NS_GET_PARENT,
@@ -769,24 +769,24 @@ static void interpolate_missing_namespaces (struct lsns *ls, struct lsns_namespa
        if (orphan->related_ns[rela])
                return;
 
-       snprintf(buf, sizeof(buf), "/proc/%d/ns/%s", orphan->proc->pid, ns_names [orphan->type]);
+       snprintf(buf, sizeof(buf), "/proc/%d/ns/%s", orphan->proc->pid, ns_names[orphan->type]);
        fd_orphan = open(buf, O_RDONLY);
        if (fd_orphan < 0)
                return;
 
-       fd_missing = ioctl (fd_orphan, cmd[rela]);
-       close (fd_orphan);
+       fd_missing = ioctl(fd_orphan, cmd[rela]);
+       close(fd_orphan);
        if (fd_missing < 0)
                return;
 
        if (fstat(fd_missing, &st) < 0
            || st.st_ino != orphan->related_id[rela]) {
-               close (fd_missing);
+               close(fd_missing);
                return;
        }
 
        orphan->related_ns[rela] = add_namespace_for_nsfd(ls, fd_missing, orphan->related_id[rela]);
-       close (fd_missing);
+       close(fd_missing);
 }
 
 static int read_namespaces(struct lsns *ls)
@@ -861,7 +861,7 @@ static int read_namespaces(struct lsns *ls)
                        struct lsns_namespace *current = orphan[rela];
                        orphan[rela] = orphan[rela]->related_ns[rela];
                        current->related_ns[rela] = NULL;
-                       interpolate_missing_namespaces (ls, current, rela);
+                       interpolate_missing_namespaces(ls, current, rela);
                }
        }