28
28
*
29
29
* Copyright (c) 1994, Regents of the University of California
30
30
*
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 $
32
32
*
33
33
*-------------------------------------------------------------------------
34
34
*/
@@ -196,8 +196,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
196
196
if ((fd = socket (family , SOCK_STREAM , 0 )) < 0 )
197
197
{
198
198
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 ) );
201
201
fputs (PQerrormsg , stderr );
202
202
pqdebug ("%s" , PQerrormsg );
203
203
return STATUS_ERROR ;
@@ -211,8 +211,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
211
211
sizeof (one ))) == -1 )
212
212
{
213
213
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 ) );
216
216
fputs (PQerrormsg , stderr );
217
217
pqdebug ("%s" , PQerrormsg );
218
218
return STATUS_ERROR ;
@@ -265,8 +265,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
265
265
if (err < 0 )
266
266
{
267
267
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 ) );
270
270
strcat (PQerrormsg ,
271
271
"\tIs another postmaster already running on that port?\n" );
272
272
if (family == AF_UNIX )
@@ -281,6 +281,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
281
281
strcat (PQerrormsg , "\tIf not, wait a few seconds and retry.\n" );
282
282
}
283
283
fputs (PQerrormsg , stderr );
284
+ pqdebug ("%s" , PQerrormsg );
284
285
return STATUS_ERROR ;
285
286
}
286
287
@@ -441,7 +442,8 @@ pq_recvbuf(void)
441
442
* if we have a hard communications failure ...
442
443
* So just write the message to the postmaster log.
443
444
*/
444
- fprintf (stderr , "pq_recvbuf: recv() failed, errno=%d\n" , errno );
445
+ fprintf (stderr , "pq_recvbuf: recv() failed: %s\n" ,
446
+ strerror (errno ));
445
447
return EOF ;
446
448
}
447
449
if (r == 0 )
@@ -609,7 +611,8 @@ pq_flush(void)
609
611
* tries to write to the client, which would cause a recursive
610
612
* flush attempt! So just write it out to the postmaster log.
611
613
*/
612
- fprintf (stderr , "pq_flush: send() failed, errno %d\n" , errno );
614
+ fprintf (stderr , "pq_flush: send() failed: %s\n" ,
615
+ strerror (errno ));
613
616
/* We drop the buffered data anyway so that processing
614
617
* can continue, even though we'll probably quit soon.
615
618
*/
0 commit comments