mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-21 09:51:50 +00:00
More work on overlay. Fixed nasty srandomdev() segfault bug.
This commit is contained in:
parent
0df58d2514
commit
b9f5448cc1
@ -22,7 +22,6 @@
|
||||
|
||||
int overlay_socket=-1;
|
||||
|
||||
|
||||
typedef struct overlay_buffer {
|
||||
unsigned char *bytes;
|
||||
int length;
|
||||
@ -291,6 +290,8 @@ int overlay_payload_package_fmt1(overlay_payload *p,overlay_buffer *b)
|
||||
if (ob_append_bytes(b,headers->bytes,headers->length)) fail++;
|
||||
if (ob_append_bytes(b,p->payload,p->payloadLength)) fail++;
|
||||
|
||||
/* XXX SIGNATURE! */
|
||||
|
||||
ob_free(headers);
|
||||
|
||||
if (fail) { ob_rewind(b); return -1; } else return 0;
|
||||
|
@ -68,7 +68,8 @@ srandomdev(void)
|
||||
#ifndef WIN32
|
||||
FILE *fd;
|
||||
|
||||
if ((fd = fopen("/dev/urandom", O_RDONLY)) >= 0) {
|
||||
fd = fopen("/dev/urandom", "r");
|
||||
if (fd >= 0) {
|
||||
fread(&seed, sizeof seed, 1, fd);
|
||||
fclose(fd);
|
||||
} else
|
||||
|
Loading…
x
Reference in New Issue
Block a user