" -e Write logmessages to stderr\n"
" -v Increase logging verbosity\n"
" -h Show this help\n\n";
- write(STDERR_FILENO, buf, sizeof(buf));
+ fputs(buf, stderr);
return 1;
}
}
-void odhcp6c_random(void *buf, size_t len)
+int odhcp6c_random(void *buf, size_t len)
{
- read(urandom_fd, buf, len);
+ return read(urandom_fd, buf, len);
}
bool odhcp6c_is_bound(void)
bool odhcp6c_signal_process(void);
uint64_t odhcp6c_get_milli_time(void);
-void odhcp6c_random(void *buf, size_t len);
+int odhcp6c_random(void *buf, size_t len);
bool odhcp6c_is_bound(void);
// State manipulation
}
-static void update_proc(const char *sect, const char *opt, uint32_t value)
+static int update_proc(const char *sect, const char *opt, uint32_t value)
{
char buf[64];
snprintf(buf, sizeof(buf), "/proc/sys/net/ipv6/%s/%s/%s", sect, if_name, opt);
int fd = open(buf, O_WRONLY);
- write(fd, buf, snprintf(buf, sizeof(buf), "%u", value));
+ int ret = write(fd, buf, snprintf(buf, sizeof(buf), "%u", value));
close(fd);
+
+ return ret;
}