Work around warn_unused_result in recent gcc/libc
[project/netifd.git] / handler.c
index 531b509..c5e47ad 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -16,7 +16,6 @@
 #include <glob.h>
 #include <fcntl.h>
 #include <stdio.h>
-#include <unistd.h>
 
 #include "netifd.h"
 #include "system.h"
@@ -28,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);
 }