From ec864c44e9959a5d65cc564182f4e960e47c6e9e Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 28 Mar 2015 17:58:44 +0100 Subject: properly handle return codes Signed-off-by: John Crispin --- src/ra.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ra.c') diff --git a/src/ra.c b/src/ra.c index 9541624..09d5c1d 100644 --- a/src/ra.c +++ b/src/ra.c @@ -165,14 +165,16 @@ static int16_t pref_to_priority(uint8_t flags) } -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; } -- cgit v1.2.1