Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4c0fe51

Browse files
committed
Remove ill-conceived CRLF translation for Windows in syslogger.
1 parent3da3c04 commit4c0fe51

File tree

1 file changed

+3
-47
lines changed

1 file changed

+3
-47
lines changed

‎src/backend/postmaster/syslogger.c

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
*
2020
* 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 $
2222
*
2323
*-------------------------------------------------------------------------
2424
*/
@@ -108,7 +108,6 @@ static volatile sig_atomic_t rotation_requested = false;
108108
staticpid_tsyslogger_forkexec(void);
109109
staticvoidsyslogger_parseArgs(intargc,char*argv[]);
110110
#endif
111-
staticvoidwrite_syslogger_file_binary(constchar*buffer,intcount);
112111

113112
#ifdefWIN32
114113
staticunsignedint __stdcallpipeThread(void*arg);
@@ -338,7 +337,7 @@ SysLoggerMain(int argc, char *argv[])
338337
}
339338
elseif (bytesRead>0)
340339
{
341-
write_syslogger_file_binary(logbuffer,bytesRead);
340+
write_syslogger_file(logbuffer,bytesRead);
342341
continue;
343342
}
344343
else
@@ -626,49 +625,6 @@ syslogger_parseArgs(int argc, char *argv[])
626625
*/
627626
void
628627
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)
672628
{
673629
intrc;
674630

@@ -716,7 +672,7 @@ pipeThread(void *arg)
716672
errmsg("could not read from logger pipe: %m")));
717673
}
718674
elseif (bytesRead>0)
719-
write_syslogger_file_binary(logbuffer,bytesRead);
675+
write_syslogger_file(logbuffer,bytesRead);
720676
}
721677

722678
/* We exit the above loop only upon detecting pipe EOF */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp