- Timestamp:
- Aug 30, 2011, 9:16:50 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanoscale/server2.c
r2430 r2449 15 15 #include <syslog.h> 16 16 #include <unistd.h> 17 #include <fcntl.h> 17 18 18 19 #include <tcl.h> 20 21 #include "config.h" 19 22 20 23 #define TRUE 1 … … 381 384 /* Accept the new connection. */ 382 385 length = sizeof(newaddr); 386 #ifdef HAVE_ACCEPT4 383 387 f = accept4(serverPtr->listenerFd, (struct sockaddr *)&newaddr, 384 388 &length, SOCK_CLOEXEC); 389 #else 390 f = accept(serverPtr->listenerFd, (struct sockaddr *)&newaddr, 391 &length); 392 #endif 385 393 if (f < 0) { 386 394 ERROR("Can't accept server \"%s\": %s", serverPtr->name, … … 388 396 exit(1); 389 397 } 398 #ifndef HAVE_ACCEPT4 399 int flags = fcntl(f, F_GETFD); 400 flags |= FD_CLOEXEC; 401 if (fcntl(f, F_SETFD, flags) < 0) { 402 ERROR("Can't set FD_CLOEXEC on socket \"%s\": %s", serverPtr->name, 403 strerror(errno)); 404 exit(1); 405 } 406 #endif 390 407 INFO("Connecting \"%s\" to %s\n", serverPtr->name, 391 408 inet_ntoa(newaddr.sin_addr));
Note: See TracChangeset
for help on using the changeset viewer.