[PATCH] 64BIT: Fix for systems with integers that are not 32 bit.
Dominik Vogt
dvogt at ffm.tc.iot.dtag.de
Mon Aug 9 08:14:27 CEST 2010
Also fixed a compiler warning.
---
src/auth_priv.cpp | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/auth_priv.cpp b/src/auth_priv.cpp
index e13071d..a920736 100644
--- a/src/auth_priv.cpp
+++ b/src/auth_priv.cpp
@@ -282,14 +282,13 @@ AuthPriv::AuthPriv(int &construct_state)
}
/* Initialize salt. srand() has been already done in Snmp::init() */
- unsigned int *rnd = (unsigned int*)&salt;
- *rnd = rand() << 1;
- if (rand() < (RAND_MAX / 2))
- *rnd += 1;
- rnd++;
- *rnd = rand() << 1;
- if (rand() < (RAND_MAX / 2))
- *rnd += 1;
+ unsigned int *rnd = (unsigned int*)(void *)&salt;
+ for (size_t i = 0; i < sizeof(salt); i += sizeof(unsigned int), rnd++)
+ {
+ *rnd = rand() << 1;
+ if (rand() < (RAND_MAX / 2))
+ *rnd += 1;
+ }
construct_state = SNMPv3_USM_OK;
--
1.5.5.6
--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment;
filename="0003-MAKE-Clean-multi-thread-core-files-also.patch"
More information about the AGENTPP
mailing list