Changeset 2367 for trunk/packages/vizservers/nanoscale
- Timestamp:
- Aug 15, 2011, 12:14:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanoscale/server2.c
r2366 r2367 388 388 INFO("after fork child=%d server=\"%s\"\n", 389 389 getpid(), serverPtr->name); 390 /* Child process. */391 if (!debug) {392 /* Detach this child process from the parent nanoscale393 * process. The current directory becomes /tmp, but don't394 * redirect stdin/stdout/stderr to /dev/null, we'll use395 * 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 402 390 /* Try to accept the connection and start the server. */ 403 391 404 392 /* Accept the new connection. */ 405 393 length = sizeof(newaddr); 406 INFO(" attempting to accept connection for server=\"%s\"\n",394 INFO("Trying to accept connection for server=\"%s\"\n", 407 395 serverPtr->name); 408 396 f = accept(serverPtr->listenerFd, (struct sockaddr *)&newaddr, … … 413 401 exit(1); 414 402 } 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 415 415 INFO("child=%d Connecting \"%s\" to %s\n", 416 416 getpid(), serverPtr->name, inet_ntoa(newaddr.sin_addr)); … … 418 418 dup2(f, 0); /* Stdin */ 419 419 dup2(f, 1); /* Stdout */ 420 421 420 for(i = 3; i <= FD_SETSIZE; i++) { 422 421 close(i); /* Close all the other descriptors. */
Note: See TracChangeset
for help on using the changeset viewer.