jail: Fix build with glibc
[project/procd.git] / jail / netifd.c
index f6f2df679451da9d34be824a106de4bf5a795424..bb205d0b241f450142304ed9fd73fbad66791f55 100644 (file)
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <errno.h>
 #include <libgen.h>
+#include <fcntl.h>
 
 #include <sys/inotify.h>
 #include <sys/stat.h>
@@ -469,6 +470,10 @@ int jail_network_start(struct ubus_context *new_ctx, char *new_jail_name, pid_t
        watch_ubus_service();
 
        netns_fd = ns_open_pid("net", ns_pid);
+       if (netns_fd < 0) {
+               ret = ESRCH;
+               goto errout_inotify;
+       }
 
        netns_updown(host_ubus_ctx, jail_name, true, netns_fd);