1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

utils: read_random() now returns the number of bytes written

This commit is contained in:
Daniel Krebs 2018-03-26 15:41:40 +02:00
parent 2724622787
commit aa1592ae2b
2 changed files with 3 additions and 3 deletions

View file

@ -240,7 +240,7 @@ int version_parse(const char *s, struct version *v);
#endif
/** Fill buffer with random data */
ssize_t read_random(char *buf, size_t len);
size_t read_random(char *buf, size_t len);
/** Get CPU timestep counter */
__attribute__((always_inline)) static inline uint64_t rdtsc()

View file

@ -260,14 +260,14 @@ void * memdup(const void *src, size_t bytes)
return dst;
}
ssize_t read_random(char *buf, size_t len)
size_t read_random(char *buf, size_t len)
{
int fd;
ssize_t bytes, total;
fd = open("/dev/urandom", O_RDONLY);
if (fd < 0)
return -1;
return 0;
bytes = 0;
total = 0;