From: Ruben Kerkhof Date: Sat, 4 Jun 2016 18:07:08 +0000 (+0200) Subject: chrony plugin: fix clang warning X-Git-Tag: collectd-5.6.0~239 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c56c81765bc2c68a0418763a692a97781ae06527;p=collectd.git chrony plugin: fix clang warning chrony.c:745:11: warning: declaration shadows a local variable [-Wshadow] int fh = open("/dev/random", 00); ^ --- diff --git a/src/chrony.c b/src/chrony.c index 4554f499..6fcea705 100644 --- a/src/chrony.c +++ b/src/chrony.c @@ -722,8 +722,10 @@ chrony_init_seq() /* Initialize the sequence number generator from /dev/urandom */ /* Fallbacks: /dev/random and time(NULL) */ + int fh; + /* Try urandom */ - int fh = open(URAND_DEVICE_PATH, O_RDONLY); + fh = open(URAND_DEVICE_PATH, O_RDONLY); if (fh >= 0) { ssize_t rc = read(fh, &g_chrony_rand, sizeof(g_chrony_rand)); @@ -742,7 +744,7 @@ chrony_init_seq() if (errno == ENOENT) { /* URAND_DEVICE_PATH device not found. Try RAND_DEVICE_PATH as fall-back */ - int fh = open(RAND_DEVICE_PATH, O_RDONLY); + fh = open(RAND_DEVICE_PATH, O_RDONLY); if (fh >= 0) { ssize_t rc = read(fh, &g_chrony_rand, sizeof(g_chrony_rand));