socket: explicitly cast time() to uint32_t
Coverity warns about this. Try to avoid the warning by casting.
We only use time() to get some (very little) entropy. The cast
is fine.
diff --git a/lib/socket.c b/lib/socket.c
index b0a6530..5f28ea8 100644
--- a/lib/socket.c
+++ b/lib/socket.c
@@ -73,7 +73,7 @@
nl_write_lock(&port_map_lock);
if (idx_state == 0) {
- uint32_t t = time(NULL);
+ uint32_t t = (uint32_t) time(NULL);
/* from time to time (on average each 2^15 calls), the idx_state will
* be zero again. No problem, just "seed" anew with time(). */
@@ -190,7 +190,8 @@
sk->s_cb = nl_cb_get(cb);
sk->s_local.nl_family = AF_NETLINK;
sk->s_peer.nl_family = AF_NETLINK;
- sk->s_seq_expect = sk->s_seq_next = time(NULL);
+ sk->s_seq_next = (unsigned int) time(NULL);
+ sk->s_seq_expect = sk->s_seq_next;
/* the port is 0 (unspecified), meaning NL_OWN_PORT */
sk->s_flags = NL_OWN_PORT;