Work around warn_unused_result in recent gcc/libc
authorSteven Barth <steven@midlink.org>
Sun, 16 Feb 2014 11:16:57 +0000 (12:16 +0100)
committerSteven Barth <steven@midlink.org>
Sun, 16 Feb 2014 11:16:57 +0000 (12:16 +0100)
handler.c
main.c
system-linux.c

index f4e27e12c3b1d342b8e879a34e07b5a434151247..c5e47adcf0a5cd087029b9349512cf4039ab0229 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -27,14 +27,14 @@ netifd_dir_push(int fd)
        int prev_fd = open(".", O_RDONLY | O_DIRECTORY);
        system_fd_set_cloexec(prev_fd);
        if (fd >= 0)
-               fchdir(fd);
+               if (fchdir(fd)) {}
        return prev_fd;
 }
 
 static void
 netifd_dir_pop(int prev_fd)
 {
-       fchdir(prev_fd);
+       if (fchdir(prev_fd)) {}
        close(prev_fd);
 }
 
diff --git a/main.c b/main.c
index d8cb17f40658f8c7a6b777270a0eb08c4c239df9..43ec24fde9f48f7394ec218f0abde82688e5eb9a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -152,7 +152,7 @@ netifd_start_process(const char **argv, char **env, struct netifd_process *proc)
                        }
                }
                if (proc->dir_fd >= 0)
-                       fchdir(proc->dir_fd);
+                       if (fchdir(proc->dir_fd)) {}
 
                close(pfds[0]);
 
index e1b992486ca54f5769b126c3e89f7d29be957c7b..cbcc5bd44a45c199112ac4c3172c3e5d50ba4b00 100644 (file)
@@ -156,7 +156,7 @@ static void system_set_sysctl(const char *path, const char *val)
        if (fd < 0)
                return;
 
-       write(fd, val, strlen(val));
+       if (write(fd, val, strlen(val))) {}
        close(fd);
 }
 
@@ -1135,7 +1135,7 @@ int system_flush_routes(void)
                if (fd < 0)
                        continue;
 
-               write(fd, "-1", 2);
+               if (write(fd, "-1", 2)) {}
                close(fd);
        }
        return 0;