Print when detaching, do not close tun when its not opened
This commit is contained in:
parent
16c46c3183
commit
96ef5da119
4
iodine.c
4
iodine.c
|
@ -232,7 +232,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tun_fd = open_tun()) == -1)
|
if ((tun_fd = open_tun()) == -1)
|
||||||
goto cleanup1;
|
goto cleanup0;
|
||||||
if ((dns_fd = open_dns(argv[0], argv[1])) == -1)
|
if ((dns_fd = open_dns(argv[0], argv[1])) == -1)
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
|
|
||||||
|
@ -249,6 +249,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foreground) {
|
if (!foreground) {
|
||||||
|
printf("Detaching from terminal...\n");
|
||||||
daemon(0, 0);
|
daemon(0, 0);
|
||||||
umask(0);
|
umask(0);
|
||||||
alarm(0);
|
alarm(0);
|
||||||
|
@ -269,6 +270,7 @@ cleanup2:
|
||||||
close_dns(dns_fd);
|
close_dns(dns_fd);
|
||||||
cleanup1:
|
cleanup1:
|
||||||
close_tun(tun_fd);
|
close_tun(tun_fd);
|
||||||
|
cleanup0:
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue