| 1522 | */ |
| 1523 | |
| 1524 | void |
| 1525 | httpInitialize(void) |
| 1526 | { |
| 1527 | static int initialized = 0; /* Have we been called before? */ |
| 1528 | #ifdef _WIN32 |
| 1529 | WSADATA winsockdata; /* WinSock data */ |
| 1530 | #endif /* _WIN32 */ |
| 1531 | |
| 1532 | |
| 1533 | _cupsGlobalLock(); |
| 1534 | if (initialized) |
| 1535 | { |
| 1536 | _cupsGlobalUnlock(); |
| 1537 | return; |
| 1538 | } |
| 1539 | |
| 1540 | #ifdef _WIN32 |
| 1541 | WSAStartup(MAKEWORD(2,2), &winsockdata); |
| 1542 | |
| 1543 | #elif !defined(SO_NOSIGPIPE) |
| 1544 | /* |
| 1545 | * Ignore SIGPIPE signals... |
| 1546 | */ |
| 1547 | |
| 1548 | # ifdef HAVE_SIGSET |
| 1549 | sigset(SIGPIPE, SIG_IGN); |
| 1550 | |
| 1551 | # elif defined(HAVE_SIGACTION) |
| 1552 | struct sigaction action; /* POSIX sigaction data */ |
| 1553 | |
| 1554 | |
| 1555 | memset(&action, 0, sizeof(action)); |
| 1556 | action.sa_handler = SIG_IGN; |
| 1557 | sigaction(SIGPIPE, &action, NULL); |
| 1558 | |
| 1559 | # else |
| 1560 | signal(SIGPIPE, SIG_IGN); |
| 1561 | # endif /* !SO_NOSIGPIPE */ |
| 1562 | #endif /* _WIN32 */ |
| 1563 | |
| 1564 | # ifdef HAVE_TLS |
| 1565 | _httpTLSInitialize(); |
| 1566 | # endif /* HAVE_TLS */ |
| 1567 | |
| 1568 | initialized = 1; |
| 1569 | _cupsGlobalUnlock(); |
| 1570 | } |
| 1571 | |
| 1572 | |
| 1573 | /* |
no test coverage detected