diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-07-13 16:24:46 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-07-13 16:26:23 +0200 |
commit | 05e3f4bf348a47b058ec005c1d350ef46305d1a2 (patch) | |
tree | f62d85cccc10774f0abfe28b34b88112e70fef74 | |
parent | 3c5bd6bcd871b2cdaa22ff810823f2c5a9cfeb0d (diff) |
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 <dborkman@redhat.com>
-rw-r--r-- | trafgen.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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) |