[CRIU] [PATCH 2/4] zdtm: fix compilation in test_msg()

Konstantin Khlebnikov khlebnikov at openvz.org
Wed Sep 12 03:48:40 EDT 2012


cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0   -c -o msg.o msg.c
msg.c: In function ‘test_msg’:
msg.c:40:6: error: variable ‘len’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Konstantin Khlebnikov <khlebnikov at openvz.org>
---
 test/zdtm/lib/msg.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/lib/msg.c b/test/zdtm/lib/msg.c
index de9185b..17a298e 100644
--- a/test/zdtm/lib/msg.c
+++ b/test/zdtm/lib/msg.c
@@ -37,7 +37,7 @@ int test_log_init(const char *fname, const char *suffix)
 void test_msg(const char *format, ...)
 {
 	va_list arg;
-	int len, off = 0;
+	int off = 0;
 	char buf[PAGE_SIZE];
 	struct timeval tv;
 	struct tm *tm;
@@ -53,7 +53,7 @@ void test_msg(const char *format, ...)
 	off += sprintf(buf + off, ".%.3ld: ", tv.tv_usec / 1000);
 	off += sprintf(buf + off, "%5d: ", getpid());
 	va_start(arg, format);
-	len = vsnprintf(buf + off, sizeof(buf) - off, format, arg);
+	off += vsnprintf(buf + off, sizeof(buf) - off, format, arg);
 	va_end(arg);
 
 	fprintf(stderr, buf);



More information about the CRIU mailing list