From 05e3f4bf348a47b058ec005c1d350ef46305d1a2 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Sat, 13 Jul 2013 16:24:46 +0200 Subject: trafgen: sparse: make seed static sparse reported that the variable seed can be made static: trafgen.c:110:14: warning: symbol 'seed' was not declared. Should it be static? While at it, also rename a local variable 'seed' to not overlap contexts. Signed-off-by: Daniel Borkmann --- trafgen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trafgen.c b/trafgen.c index 726959b..9784366 100644 --- a/trafgen.c +++ b/trafgen.c @@ -107,7 +107,7 @@ static int sock; static struct itimerval itimer; static unsigned long interval = TX_KERNEL_PULL_INT; static struct cpu_stats *stats; -unsigned int seed; +static unsigned int seed; #define CPU_STATS_STATE_CFG 1 #define CPU_STATS_STATE_CHK 2 @@ -862,16 +862,16 @@ static void main_loop(struct ctx *ctx, char *confname, bool slow, static unsigned int generate_srand_seed(void) { int fd; - unsigned int seed; + unsigned int _seed; fd = open("/dev/urandom", O_RDONLY); if (fd < 0) return time(0); - read_or_die(fd, &seed, sizeof(seed)); + read_or_die(fd, &_seed, sizeof(_seed)); close(fd); - return seed; + return _seed; } int main(int argc, char **argv) -- cgit v1.2.3-54-g00ecf