The Solaris libc has some issues with alternating input and output
on sockets passed to fdopen(). Apparently there is a shared buffer
which has to be emptied, either by fseek() or fflush(), whenever
the direction of the data flow changes.
When trying to connect the strace tool to the daemon's main process, the
daemon would die because strace interrupted the poll() causing it to
return EINTR.
It should be safe to ignore EINTR errors from poll in this case. Either
the received signal will be otherwise ignored by the process, or it will
cause it to terminate.
By keeping the listen sockets open, the children were preventing the
daemon from being restarted cleanly. Once the child has forked these
listen sockets are no longer needed by that process, so can be closed.
The secrets file is now parsed line by line, and
each line (excluding CR and/or LF) is used as a secret.
Only the first secret is used for signing, but all
secrets are used for verification.