The exit codes of /usr/sbin/pcscd seem to be broken. If HAL is not around pcscd will complain about that to syslog and exit(0). The init script will pass that on, so that the caller thinks the service properly started up. However, it actually isn't, and a subsequent "/etc/init.d/pcscd stop" then fails, although it shouldn't if the start return code was 0. Or short: when the daemon fails to start up you *must* return an exit code > 0. Not doing this is neither compatible with the fedora policy, nor the LSB.
Adding upstream author Ludovic Rousseau to CC. I looked at the code and it appears that pcscd first calls daemon(), which makes the forked parent process return with exit code 0. After forking, the child process goes on to try to talk with hal. If the connection to hal fails, the _child_ process returns with a non-zero exit code. Ludovic, do you think it would be possible to fix it somehow so that the error condition is checked _before_ forking?
You should not set up the HAL context before forking and then continue to use it after the fork. Most libraries cannot deal with forking and libdbus isn't any different there. Instead, create a pipe before forking and then have the child signal success/failure writing to the pipe and reading it on the parent process side. When daemonizing it is important that the child is fully providing its services when the parent process exits, since the exiting is used to synchronize startup. Hence you should do the pipe trick anyway.
It means I can't use daemon(3) and must (manually) use fork(2) instead. daemon uses fork+exit but I need fork and later, after some code, exit. I will try to implement this.
Fixed in revision 4969 http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2010-June/004521.html
Thanks for fixing it, Ludovic! I just built pcsc-lite 1.6.1 in rawhide which includes the fix; closing the ticket.