|
11 | 11 | * |
12 | 12 | * |
13 | 13 | * IDENTIFICATION |
14 | | - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.69 2005/08/2320:48:47 momjian Exp $ |
| 14 | + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.70 2005/08/2321:02:03 momjian Exp $ |
15 | 15 | * |
16 | 16 | * NOTES |
17 | 17 | * [ Most of these notes are wrong/obsolete, but perhaps not all ] |
|
103 | 103 | #include<sys/stat.h> |
104 | 104 |
|
105 | 105 | #ifdefENABLE_THREAD_SAFETY |
| 106 | +#ifdefWIN32 |
| 107 | +#include"pthread-win32.h" |
| 108 | +#else |
106 | 109 | #include<pthread.h> |
107 | 110 | #endif |
| 111 | +#endif |
108 | 112 |
|
109 | 113 | #ifndefHAVE_STRDUP |
110 | 114 | #include"strdup.h" |
@@ -388,20 +392,21 @@ ssize_t |
388 | 392 | pqsecure_write(PGconn*conn,constvoid*ptr,size_tlen) |
389 | 393 | { |
390 | 394 | ssize_tn; |
391 | | - |
| 395 | + |
| 396 | +#ifndefWIN32 |
392 | 397 | #ifdefENABLE_THREAD_SAFETY |
393 | 398 | sigset_tosigmask; |
394 | 399 | boolsigpipe_pending; |
395 | 400 | boolgot_epipe= false; |
396 | 401 |
|
| 402 | + |
397 | 403 | if (pq_block_sigpipe(&osigmask,&sigpipe_pending)<0) |
398 | 404 | return-1; |
399 | 405 | #else |
400 | | -#ifndefWIN32 |
401 | 406 | pqsigfuncoldsighandler=pqsignal(SIGPIPE,SIG_IGN); |
402 | | -#endif |
403 | | -#endif |
404 | | - |
| 407 | +#endif/* ENABLE_THREAD_SAFETY */ |
| 408 | +#endif/* WIN32 */ |
| 409 | +
|
405 | 410 | #ifdefUSE_SSL |
406 | 411 | if (conn->ssl) |
407 | 412 | { |
@@ -431,7 +436,7 @@ pqsecure_write(PGconn *conn, const void *ptr, size_t len) |
431 | 436 |
|
432 | 437 | if (n==-1) |
433 | 438 | { |
434 | | -#ifdefENABLE_THREAD_SAFETY |
| 439 | +#if defined(ENABLE_THREAD_SAFETY)&& !defined(WIN32) |
435 | 440 | if (SOCK_ERRNO==EPIPE) |
436 | 441 | got_epipe= true; |
437 | 442 | #endif |
@@ -473,19 +478,19 @@ pqsecure_write(PGconn *conn, const void *ptr, size_t len) |
473 | 478 | #endif |
474 | 479 | { |
475 | 480 | n=send(conn->sock,ptr,len,0); |
476 | | -#ifdefENABLE_THREAD_SAFETY |
| 481 | +#if defined(ENABLE_THREAD_SAFETY)&& !defined(WIN32) |
477 | 482 | if (n<0&&SOCK_ERRNO==EPIPE) |
478 | 483 | got_epipe= true; |
479 | 484 | #endif |
480 | 485 | } |
481 | | - |
| 486 | + |
| 487 | +#ifndefWIN32 |
482 | 488 | #ifdefENABLE_THREAD_SAFETY |
483 | 489 | pq_reset_sigpipe(&osigmask,sigpipe_pending,got_epipe); |
484 | 490 | #else |
485 | | -#ifndefWIN32 |
486 | 491 | pqsignal(SIGPIPE,oldsighandler); |
487 | | -#endif |
488 | | -#endif |
| 492 | +#endif/* ENABLE_THREAD_SAFETY */ |
| 493 | +#endif/* WIN32 */ |
489 | 494 |
|
490 | 495 | returnn; |
491 | 496 | } |
@@ -1232,7 +1237,7 @@ PQgetssl(PGconn *conn) |
1232 | 1237 |
|
1233 | 1238 | #endif/* USE_SSL */ |
1234 | 1239 |
|
1235 | | -#ifdefENABLE_THREAD_SAFETY |
| 1240 | +#if defined(ENABLE_THREAD_SAFETY)&& !defined(WIN32) |
1236 | 1241 |
|
1237 | 1242 | /* |
1238 | 1243 | *Block SIGPIPE for this thread. This prevents send()/write() from exiting |
|