Why the sleep() call?

On 16 Feb 2002, Colin Walters <[EMAIL PROTECTED]> wrote:
> Index: socket.c
> ===================================================================
> RCS file: /cvsroot/rsync/socket.c,v
> retrieving revision 1.74
> diff -u -u -r1.74 socket.c
> +++ socket.c  16 Feb 2002 23:08:47 -0000
> @@ -387,6 +387,7 @@
>          for each incoming connection */
>       while (1) {
>               fd_set fds;
> +             pid_t pid;
>               int fd;
>               struct sockaddr_storage addr;
>               socklen_t addrlen = sizeof addr;
> @@ -418,12 +419,17 @@
>                  while (waitpid(-1, NULL, WNOHANG) > 0);
>  #endif
>  
> -             if (fork()==0) {
> +             if ((pid = fork()) == 0) {
>                       close(s);
>                       /* open log file in child before possibly giving
>                          up privileges  */
>                       log_open();
>                       _exit(fn(fd));
> +             } else if (pid < 0) {
> +                     rprintf(FERROR, "could not create child process: %s\n",
> +                             strerror(errno));
> +                     close(fd);
> +                     sleep(2);
>               }
>  
>               close(fd);

-- 
Martin 

Reply via email to