]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tests: stop cutting off right square brackets in share_ns 3794/head
authorEvgeny Vereshchagin <evvers@ya.ru>
Sun, 11 Apr 2021 15:02:20 +0000 (15:02 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Sun, 11 Apr 2021 15:07:47 +0000 (15:07 +0000)
Closes https://github.com/lxc/lxc/issues/3791

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
src/tests/share_ns.c

index f8cef4763a3087f0ddf465ebeb38a96e3124fcd2..305f5cca4d54935732f9969d256e5845e22488f3 100644 (file)
@@ -137,7 +137,7 @@ __noreturn static void *ns_sharing_wrapper(void *data)
                lxc_error("Failed to retrieve ipc namespace for container \"%s\"\n", name);
                goto out;
        }
-       ns_buf[ret == 0 ? ret : ret - 1] = '\0';
+       ns_buf[ret] = '\0';
 
        if (strcmp(args->inherited_ipc_ns, ns_buf) != 0) {
                lxc_error("Failed to inherit ipc namespace from container \"owning-ns\": %s != %s\n", args->inherited_ipc_ns, ns_buf);
@@ -157,7 +157,7 @@ __noreturn static void *ns_sharing_wrapper(void *data)
                lxc_error("Failed to retrieve ipc namespace for container \"%s\"\n", name);
                goto out;
        }
-       ns_buf[ret == 0 ? ret : ret - 1] = '\0';
+       ns_buf[ret] = '\0';
 
        if (strcmp(args->inherited_net_ns, ns_buf) != 0) {
                lxc_error("Failed to inherit net namespace from container \"owning-ns\": %s != %s\n", args->inherited_net_ns, ns_buf);