From 7c8ff3bc2578bbba09ef3f460b8d0f1c16bcd03e Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Wed, 22 Jan 2014 12:16:06 -0800 Subject: [PATCH] linux: move sscanf() out of the assert() If asserts are turned off then the sscanf() wouldn't have run, being placed directly in the assert() itself. --- src/unix/linux-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/unix/linux-core.c b/src/unix/linux-core.c index 74294eb2..2e96d54b 100644 --- a/src/unix/linux-core.c +++ b/src/unix/linux-core.c @@ -602,7 +602,9 @@ static int read_times(unsigned int numcpus, uv_cpu_info_t* ci) { /* skip "cpu " marker */ { unsigned int n; - assert(sscanf(buf, "cpu%u ", &n) == 1); + int r = sscanf(buf, "cpu%u ", &n); + assert(r == 1); + (void) r; // silence build warning for (len = sizeof("cpu0"); n /= 10; len++); }