Argh! There is one thing stopping me from releasing the latest version
of my shareware: it doesn't work on 10.1.
I've narrowed it down to exactly this line:
signal(SIGCHLD, fireman);
The line before this one is executed, but the line after is not. The
application dies straightaway. The really funky (s/n/c/) thing is that
I've got another test application which looks like this:
int main(int argc, char* argv[])
{
printf("Hello\n");
signal(SIGCHLD, signalCatch);
daemon(0, 0);
switch(fork())
{
case 0:
syslog(LOG_INFO, "Child1");
exit(EXIT_SUCCESS);
default:
syslog(LOG_INFO, "Parent");
for(;

;
}
return 0;
}
void signalCatch(int para)
{
syslog(LOG_INFO, "Caught");
}
Which works exactly as you would expect on 10.1 and 10.2. The start of
my real application looks like this:
int main(int argc, char* argv[])
{
int clientSocket;
char *authStr;
JSFunction *compiledPAC;
if(argc != 7)
{
syslog(LOG_ERR, "Fatal Error: authoxyd needs 6 command line
parameters. Check there are no spaces in your settings.");
return 1;
}
syslog(LOG_ERR, "One.");
signal(SIGCHLD, fireman);
syslog(LOG_ERR, "Two.");
daemon(0, 0);
syslog(LOG_ERR, "Three.");
....
void fireman(int sig)
{
while (waitpid(-1, NULL, WNOHANG) > 0)
;
}
But "Two." is never written to the system log! I've tried changing the
order of statements, changing the signiture of the signal handler,
making sacrifices, and still no luck. Why on earth would one of these
programs work and the other not? My real program is started by a
preference pane with a system() call which passes various arguments, but
it doesn't appear to matter if I call it manually from the command line.
I don't have the developer tools installed on my 10.1 install, which may
or may not be relevant. I know it makes it very hard to debug!
Has anyone got the slightest of clues? I'm really unsure where to go
from here! The only thing I can think of that has changed between when
this did work is perhaps my library linking. My app now links to the
static libdl library (as well as libcurl and libjs) but I can't imagine
why this would matter. signal is part of the standard c library (libc)
which should be dynamically linked as normal, right?
--
Heath
________________________________________________________
| *Nothing is foolproof to a sufficiently talented fool* |
| _\|/_ |
|________________________________________m(. .)m_________|