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