--- sophie.c.orig Wed Feb 27 19:10:02 2002 +++ sophie.c Wed Feb 27 19:14:12 2002 @@ -263,7 +263,7 @@ sophie_print(1, "server.sun_path has a name: [%s]", SOPHIE_SOCKET_NAME); /* Bind a socket */ - if (bind(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) == -1) + if (bind(sock, (struct sockaddr *) &server, SUN_LEN(&server)) == -1) { sophie_print(0, "ERROR: bind() failed in main()"); exit(1); @@ -429,6 +429,7 @@ struct sigaction sa_handle; FILE *msgfp; struct stat reqstat; + struct itimerval itimer; /* bzero((char *)(&sa_exit), sizeof(sa_exit)); */ sigemptyset(&sa_handle.sa_mask); @@ -448,7 +449,12 @@ We will set the alarm (timeout) If Sophie doesn't receive anythin within SOPHIE_TIMEOUT seconds - quit */ - alarm(SOPHIE_TIMEOUT); + itimer.it_interval.tv_sec = 0; + itimer.it_interval.tv_usec = 0; + itimer.it_value.tv_sec = SOPHIE_TIMEOUT; + itimer.it_value.tv_usec = 0; + + setitimer(ITIMER_REAL, &itimer, NULL); /* We will 'reopen' the socket, for fgets - I am lazy... :) */ msgfp = fdopen(msgsock, "r"); @@ -520,7 +526,11 @@ sophie_print(1, "closing the socket"); } - alarm(0); + itimer.it_interval.tv_sec = 0; + itimer.it_interval.tv_usec = 0; + itimer.it_value.tv_sec = 0; + itimer.it_value.tv_usec = 0; + setitimer(ITIMER_REAL, &itimer, NULL); sophie_print(1, "i am gone..."); exit(0);