-static void
-read_urandom(void *buffer, size_t n)
-{
- static const char urandom[] = "/dev/urandom";
- size_t bytes_read;
- int error;
- int fd;
-
- fd = open(urandom, O_RDONLY);
- if (fd < 0) {
- ovs_fatal(errno, "%s: open failed", urandom);
- }
- error = read_fully(fd, buffer, n, &bytes_read);
- if (error == EOF) {
- ovs_fatal(0, "%s: unexpected end of file", urandom);
- } else if (error) {
- ovs_fatal(error, "%s: read error", urandom);
- }
- close(fd);
-}
-