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:
parent
2724622787
commit
aa1592ae2b
2 changed files with 3 additions and 3 deletions
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue