From: Evgeny Vereshchagin Date: Sun, 11 Apr 2021 15:02:20 +0000 (+0000) Subject: tests: stop cutting off right square brackets in share_ns X-Git-Tag: lxc-5.0.0~204^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11ead2c46aae0495636960a086741fabc1ffc194;p=thirdparty%2Flxc.git tests: stop cutting off right square brackets in share_ns Closes https://github.com/lxc/lxc/issues/3791 Signed-off-by: Evgeny Vereshchagin --- diff --git a/src/tests/share_ns.c b/src/tests/share_ns.c index f8cef4763..305f5cca4 100644 --- a/src/tests/share_ns.c +++ b/src/tests/share_ns.c @@ -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);