- if (n < 0) die(1, "error reading `/dev/urandom': %s", strerror(errno));
- else if (n < sz) die(1, "unexpected short read from `/dev/urandom'");
+ if (n < 0) fatal("error reading `/dev/urandom': %s", strerror(errno));
+ else if (n < sz) fatal("unexpected short read from `/dev/urandom'");
/* Open a netlink socket for interrogating the kernel. */
if ((fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0)
/* Open a netlink socket for interrogating the kernel. */
if ((fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0)
/* We want to read the routing table. There doesn't seem to be a good way
* to do this without just crawling through the whole thing.
/* We want to read the routing table. There doesn't seem to be a good way
* to do this without just crawling through the whole thing.
rtgen->rtgen_family = af;
if (write(fd, nlmsg, nlmsg->nlmsg_len) < 0)
rtgen->rtgen_family = af;
if (write(fd, nlmsg, nlmsg->nlmsg_len) < 0)
/* Now we try to parse the answer. */
for (;;) {
/* Not finished yet, so read another chunk of answer. */
if ((n = read(fd, buf, sizeof(buf))) < 0)
/* Now we try to parse the answer. */
for (;;) {
/* Not finished yet, so read another chunk of answer. */
if ((n = read(fd, buf, sizeof(buf))) < 0)