If the tun-if can't be initialized correctly, close the vpn-helper
[oweals/gnunet.git] / src / vpn / gnunet-helper-vpn.c
index 4a75182f9a893821ebd17abaa789e4b6841bdbaa..83c0af4539cc49005a28c921f8f854edfd27131a 100644 (file)
@@ -122,6 +122,12 @@ int main(int argc, char** argv) {
        signal(SIGTERM, &term);
 
        int fd_tun = init_tun(dev);
+
+       if (fd_tun < 0) {
+               fprintf(stderr, "Could not initialize tun-interface: %m\n");
+               exit(1);
+       }
+
        fprintf(stderr, "Initialized the interface %s as %d.\n", dev, fd_tun);
 
        // TODO: get this out of argv