aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-10-26 09:39:35 +0100
committerToni Uhlig <matzeton@googlemail.com>2020-10-26 09:39:35 +0100
commitb85fe6e68f7e46dbea7fedff47da06d05966ebfb (patch)
tree6023533c5a37d27a00b63f02567fc11a6026470f /client.c
parent4ba484be6ef6e1f759fdb6dbde056592143cbd14 (diff)
Finished timestamp refactoring.
- adjusted -W* CFLAGS - replaced suseconds_t with uint32_t for nanoseconds extraction - fixed (now) invalid format specifiers - added WARN_UNUSED_RESULT macro usable to warn if a fn return value is unused Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'client.c')
-rw-r--r--client.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/client.c b/client.c
index e759b03..7902165 100644
--- a/client.c
+++ b/client.c
@@ -32,7 +32,7 @@ static void send_data(struct connection * const state)
if (data_fd >= 0) {
bytes_read = read(data_fd, buf, sizeof(buf));
- if (bytes_read <= 0 || ev_protocol_data(state, buf, bytes_read) != 0) {
+ if (bytes_read <= 0 || ev_protocol_data(state, buf, (uint32_t)bytes_read) != 0) {
if (bytes_read == 0) {
LOG(WARNING, "EoF: Closing file descriptor %d aka %s", data_fd, opts.filepath);
} else {
@@ -273,7 +273,9 @@ int main(int argc, char ** argv)
return 2;
}
- srandom(time(NULL));
+ double ts = create_timestamp();
+ uint64_t ts_seed = (uint64_t)ts + extract_nsecs(ts);
+ srandom(ts_seed);
if (sodium_init() != 0) {
LOG(ERROR, "Sodium init failed");