c-daemon-2

This commit is contained in:
Aliberk Sandıkçı 2023-07-26 11:23:33 +03:00
parent b151c1c285
commit f5a4df3bb3
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1
2 changed files with 3 additions and 1 deletions

View file

@ -20,5 +20,8 @@ int _daemon(int nochdir, int noclose){
else if (pid > 0){ else if (pid > 0){
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (setsid() == -1){
return -1;
}
return 0; return 0;
} }

View file

@ -3,7 +3,6 @@
int _daemon (int, int); int _daemon (int, int);
int main(){ int main(){
getchar();
_daemon(0, 0); _daemon(0, 0);
getchar(); getchar();
return 0; return 0;