Arvinn Løkkebakken wrote: > Arvinn Løkkebakken wrote: >> Hi. Thanks for a fine product. >> >> I have set DAEMON=1 in the config. >> I have some troubles with running policyd as a daemon though. Every time >> after starting policyd in a ssh terminal I am not able to end the ssh >> terminal when logging out afterwards. The ssh terminal lives forever >> until I kill the policyd process that was started from within it, or >> until I kill the sshd process itself. >> Does anybody else experience the same problem? >> >> OS:. CentOS 5 >> Policyd 1.82. >> >> Regards, >> Arvinn >> > A colleague of mine looked over the code and did the following changes. > Here's the patch I created of the the changes: > > --- sockets.c.orig 2007-08-20 08:42:05.000000000 +0200 > +++ sockets.c 2007-12-04 09:55:34.000000000 +0100 > @@ -452,11 +452,11 @@ > _exit(0); /* child 1 terminates */ > > /* child 2 continues */ > - if(nochdir) > + if(!nochdir) > chdir("/"); /* change working directory */ > > /* close off all file descriptors */ > - if(noclose) > + if(!noclose) > for(i=0;i<64;i++) > close(i); > > > .. claiming that the code did not seem logically correct before. If > noclose is set, why close? Anyway, with these changes my problem is gone :)
Your friend is correct, the patch approach however isn't. > Cami, I'll try your patch too. Thanks. Ignore the previous patch, it still doesn't solve the correct problem. Corrected patch below: --- generic.c 2007-12-04 11:32:30.000000000 +0200 +++ generic.c 2007-12-04 11:33:36.000000000 +0200 @@ -693,7 +693,7 @@ /* dont let cleanup run in the background */ if(prog == 0) { - if(daemonize(0,0) == -1) + if(daemonize(1,1) == -1) { fprintf(stderr, "daemon(): %s\n", strerror(errno)); exit(-1); Nigel, please apply against dev branch as well. Arvinn, thanks for the bug report/solution. Regards, Cami ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ policyd-users mailing list policyd-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/policyd-users