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

Commitb3ad498

Browse files
committed
Report strerror() rather than errno in low-level backend libpq
failure messages.
1 parent9a6184d commitb3ad498

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

‎src/backend/libpq/pqcomm.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* Copyright (c) 1994, Regents of the University of California
3030
*
31-
* $Id: pqcomm.c,v 1.70 1999/05/10 16:10:34 momjian Exp $
31+
* $Id: pqcomm.c,v 1.71 1999/05/21 01:25:06 tgl Exp $
3232
*
3333
*-------------------------------------------------------------------------
3434
*/
@@ -196,8 +196,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
196196
if ((fd=socket(family,SOCK_STREAM,0))<0)
197197
{
198198
snprintf(PQerrormsg,ERROR_MSG_LENGTH,
199-
"FATAL: StreamServerPort: socket() failed:errno=%d\n",
200-
errno);
199+
"FATAL: StreamServerPort: socket() failed:%s\n",
200+
strerror(errno));
201201
fputs(PQerrormsg,stderr);
202202
pqdebug("%s",PQerrormsg);
203203
returnSTATUS_ERROR;
@@ -211,8 +211,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
211211
sizeof(one)))==-1)
212212
{
213213
snprintf(PQerrormsg,ERROR_MSG_LENGTH,
214-
"FATAL: StreamServerPort: setsockopt(SO_REUSEADDR) failed:errno=%d\n",
215-
errno);
214+
"FATAL: StreamServerPort: setsockopt(SO_REUSEADDR) failed:%s\n",
215+
strerror(errno));
216216
fputs(PQerrormsg,stderr);
217217
pqdebug("%s",PQerrormsg);
218218
returnSTATUS_ERROR;
@@ -265,8 +265,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
265265
if (err<0)
266266
{
267267
snprintf(PQerrormsg,ERROR_MSG_LENGTH,
268-
"FATAL: StreamServerPort: bind() failed:errno=%d\n",errno);
269-
pqdebug("%s",PQerrormsg);
268+
"FATAL: StreamServerPort: bind() failed:%s\n",
269+
strerror(errno));
270270
strcat(PQerrormsg,
271271
"\tIs another postmaster already running on that port?\n");
272272
if (family==AF_UNIX)
@@ -281,6 +281,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
281281
strcat(PQerrormsg,"\tIf not, wait a few seconds and retry.\n");
282282
}
283283
fputs(PQerrormsg,stderr);
284+
pqdebug("%s",PQerrormsg);
284285
returnSTATUS_ERROR;
285286
}
286287

@@ -441,7 +442,8 @@ pq_recvbuf(void)
441442
* if we have a hard communications failure ...
442443
* So just write the message to the postmaster log.
443444
*/
444-
fprintf(stderr,"pq_recvbuf: recv() failed, errno=%d\n",errno);
445+
fprintf(stderr,"pq_recvbuf: recv() failed: %s\n",
446+
strerror(errno));
445447
returnEOF;
446448
}
447449
if (r==0)
@@ -609,7 +611,8 @@ pq_flush(void)
609611
* tries to write to the client, which would cause a recursive
610612
* flush attempt! So just write it out to the postmaster log.
611613
*/
612-
fprintf(stderr,"pq_flush: send() failed, errno %d\n",errno);
614+
fprintf(stderr,"pq_flush: send() failed: %s\n",
615+
strerror(errno));
613616
/* We drop the buffered data anyway so that processing
614617
* can continue, even though we'll probably quit soon.
615618
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp