Ignore:
Timestamp:
Aug 15, 2011 12:14:23 PM (13 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanoscale/server2.c

    r2366 r2367  
    388388                INFO("after fork child=%d server=\"%s\"\n",
    389389                     getpid(), serverPtr->name);
    390                 /* Child process. */
    391                 if (!debug) {
    392                     /* Detach this child process from the parent nanoscale
    393                      * process. The current directory becomes /tmp, but don't
    394                      * redirect stdin/stdout/stderr to /dev/null, we'll use
    395                      * that to connect to the socket. */
    396                     if (daemon(0, 1) < 0) {
    397                         ERROR("can't daemonize \"%s\": %s", serverPtr->name,
    398                               strerror(errno));
    399                     }
    400                 }                           
    401 
    402390                /* Try to accept the connection and start the server.  */
    403391
    404392                /* Accept the new connection. */
    405393                length = sizeof(newaddr);
    406                 INFO("attempting to accept connection for server=\"%s\"\n",
     394                INFO("Trying to accept connection for server=\"%s\"\n",
    407395                     serverPtr->name);
    408396                f = accept(serverPtr->listenerFd, (struct sockaddr *)&newaddr,
     
    413401                    exit(1);
    414402                }
     403                /* Child process. */
     404                if (!debug) {
     405                    /* Detach this child process from the parent nanoscale
     406                     * process. The current directory becomes /tmp, but don't
     407                     * redirect stdin/stdout/stderr to /dev/null, we'll use
     408                     * that to connect to the socket. */
     409                    if (daemon(0, 0) < 0) {
     410                        ERROR("can't daemonize \"%s\": %s", serverPtr->name,
     411                              strerror(errno));
     412                    }
     413                }                           
     414
    415415                INFO("child=%d Connecting \"%s\" to %s\n",
    416416                     getpid(), serverPtr->name, inet_ntoa(newaddr.sin_addr));
     
    418418                dup2(f, 0);             /* Stdin */
    419419                dup2(f, 1);             /* Stdout */
    420                
    421420                for(i = 3; i <= FD_SETSIZE; i++) {
    422421                    close(i);   /* Close all the other descriptors. */
Note: See TracChangeset for help on using the changeset viewer.