static void handle_signal(int signal)
{
char b[1] = {0};
- if (signal == SIGHUP)
- write(reload_pipe[1], b, sizeof(b));
- else
+
+ if (signal == SIGHUP) {
+ if (write(reload_pipe[1], b, sizeof(b)) < 0) {}
+ } else
uloop_end();
}
static void reload_cb(struct uloop_fd *u, _unused unsigned int events)
{
char b[512];
- read(u->fd, b, sizeof(b));
+ if (read(u->fd, b, sizeof(b) < 0)) {}
odhcpd_reload();
}
void odhcpd_run(void)
{
- pipe2(reload_pipe, O_NONBLOCK | O_CLOEXEC);
+ if (pipe2(reload_pipe, O_NONBLOCK | O_CLOEXEC) < 0) {}
reload_fd.fd = reload_pipe[0];
uloop_fd_add(&reload_fd, ULOOP_READ);
return;
lockf(fd, F_LOCK, 0);
- ftruncate(fd, 0);
+ if (ftruncate(fd, 0) < 0) {}
FILE *fp = fdopen(fd, "w");
if (!fp) {
iface->ndp_event.uloop.fd = -1;
if (!enable || iface->ndp != RELAYD_RELAY)
- write(procfd, "0\n", 2);
+ if (write(procfd, "0\n", 2) < 0) {}
dump_neigh = true;
}
}
if (enable && iface->ndp == RELAYD_RELAY) {
- write(procfd, "1\n", 2);
+ if (write(procfd, "1\n", 2) < 0) {}
close(procfd);
int sock = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC, htons(ETH_P_IPV6));
odhcpd_receive_packets(&event->uloop, 0);
}
-void odhcpd_urandom(void *data, size_t len)
+int odhcpd_urandom(void *data, size_t len)
{
- read(urandom_fd, data, len);
+ return read(urandom_fd, data, len);
}
int odhcpd_get_mac(const struct interface *iface, uint8_t mac[6]);
struct interface* odhcpd_get_interface_by_index(int ifindex);
struct interface* odhcpd_get_master_interface(void);
-void odhcpd_urandom(void *data, size_t len);
+int odhcpd_urandom(void *data, size_t len);
void odhcpd_setup_route(const struct in6_addr *addr, int prefixlen,
const struct interface *iface, const struct in6_addr *gw, bool add);