c-daemon-2
This commit is contained in:
parent
b151c1c285
commit
f5a4df3bb3
2 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue