From 5ffa8c818120e35c89becd938d160235c069dd12 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Tue, 27 Jan 2015 08:00:11 -0500 Subject: Add a snprinf wrapper which checks that the buffer was big enough If we scale our buffer to be wide enough for the format string, we should expect that the calculation was correct. char_array_0() invocations are removed, since snprintf nul-terminates the output in any case. A similar wrapper is used for strftime calls, but only in timedatectl.c. --- src/shared/switch-root.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/shared/switch-root.c') diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c index ca3875628a..e8cedc69cc 100644 --- a/src/shared/switch-root.c +++ b/src/shared/switch-root.c @@ -72,7 +72,6 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, struct stat sb; snprintf(new_mount, sizeof(new_mount), "%s%s", new_root, i); - char_array_0(new_mount); mkdir_p_label(new_mount, 0755); -- cgit v1.2.3-54-g00ecf