Replace direct calls to recv with read_bytes. (#78)

* Replace direct calls to recv with read_bytes.

* Fixes.

* Formatting.
This commit is contained in:
Robert Nishihara
2016-12-02 18:51:50 -08:00
committed by Philipp Moritz
parent de2dd1f506
commit 61755bc168
3 changed files with 18 additions and 6 deletions
+3 -1
View File
@@ -6,6 +6,8 @@
#include <sys/stat.h>
#include <fcntl.h>
#include "io.h"
/* This is used to define the array of object IDs. */
const UT_icd object_id_icd = {sizeof(object_id), NULL, NULL, NULL};
@@ -20,7 +22,7 @@ unique_id globally_unique_id(void) {
LOG_ERROR("Could not generate random number");
}
unique_id result;
read(fd, &result.id[0], UNIQUE_ID_SIZE);
CHECK(read_bytes(fd, &result.id[0], UNIQUE_ID_SIZE) >= 0);
close(fd);
return result;
}