|
18 | 18 | *
|
19 | 19 | *
|
20 | 20 | * IDENTIFICATION
|
21 |
| - * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.30 2007/01/05 22:19:36 momjian Exp $ |
| 21 | + * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.31 2007/06/04 22:21:42 adunstan Exp $ |
22 | 22 | *
|
23 | 23 | *-------------------------------------------------------------------------
|
24 | 24 | */
|
@@ -108,7 +108,6 @@ static volatile sig_atomic_t rotation_requested = false;
|
108 | 108 | staticpid_tsyslogger_forkexec(void);
|
109 | 109 | staticvoidsyslogger_parseArgs(intargc,char*argv[]);
|
110 | 110 | #endif
|
111 |
| -staticvoidwrite_syslogger_file_binary(constchar*buffer,intcount); |
112 | 111 |
|
113 | 112 | #ifdefWIN32
|
114 | 113 | staticunsignedint __stdcallpipeThread(void*arg);
|
@@ -338,7 +337,7 @@ SysLoggerMain(int argc, char *argv[])
|
338 | 337 | }
|
339 | 338 | elseif (bytesRead>0)
|
340 | 339 | {
|
341 |
| -write_syslogger_file_binary(logbuffer,bytesRead); |
| 340 | +write_syslogger_file(logbuffer,bytesRead); |
342 | 341 | continue;
|
343 | 342 | }
|
344 | 343 | else
|
@@ -626,49 +625,6 @@ syslogger_parseArgs(int argc, char *argv[])
|
626 | 625 | */
|
627 | 626 | void
|
628 | 627 | write_syslogger_file(constchar*buffer,intcount)
|
629 |
| -{ |
630 |
| -#ifdefWIN32 |
631 |
| - |
632 |
| -/* |
633 |
| - * On Windows we need to do our own newline-to-CRLF translation. |
634 |
| - */ |
635 |
| -charconvbuf[256]; |
636 |
| -char*p; |
637 |
| -intn; |
638 |
| - |
639 |
| -p=convbuf; |
640 |
| -n=0; |
641 |
| -while (count-->0) |
642 |
| -{ |
643 |
| -if (*buffer=='\n') |
644 |
| -{ |
645 |
| -*p++='\r'; |
646 |
| -n++; |
647 |
| -} |
648 |
| -*p++=*buffer++; |
649 |
| -n++; |
650 |
| -if (n >=sizeof(convbuf)-1) |
651 |
| -{ |
652 |
| -write_syslogger_file_binary(convbuf,n); |
653 |
| -p=convbuf; |
654 |
| -n=0; |
655 |
| -} |
656 |
| -} |
657 |
| -if (n>0) |
658 |
| -write_syslogger_file_binary(convbuf,n); |
659 |
| -#else/* !WIN32 */ |
660 |
| -write_syslogger_file_binary(buffer,count); |
661 |
| -#endif |
662 |
| -} |
663 |
| - |
664 |
| -/* |
665 |
| - * Write binary data to the currently open logfile |
666 |
| - * |
667 |
| - * On Windows the data arriving in the pipe already has CR/LF newlines, |
668 |
| - * so we must send it to the file without further translation. |
669 |
| - */ |
670 |
| -staticvoid |
671 |
| -write_syslogger_file_binary(constchar*buffer,intcount) |
672 | 628 | {
|
673 | 629 | intrc;
|
674 | 630 |
|
@@ -716,7 +672,7 @@ pipeThread(void *arg)
|
716 | 672 | errmsg("could not read from logger pipe: %m")));
|
717 | 673 | }
|
718 | 674 | elseif (bytesRead>0)
|
719 |
| -write_syslogger_file_binary(logbuffer,bytesRead); |
| 675 | +write_syslogger_file(logbuffer,bytesRead); |
720 | 676 | }
|
721 | 677 |
|
722 | 678 | /* We exit the above loop only upon detecting pipe EOF */
|
|