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)
196196if ((fd = socket (family ,SOCK_STREAM ,0 ))< 0 )
197197{
198198snprintf (PQerrormsg ,ERROR_MSG_LENGTH ,
199- "FATAL: StreamServerPort: socket() failed:errno=%d \n" ,
200- errno );
199+ "FATAL: StreamServerPort: socket() failed:%s \n" ,
200+ strerror ( errno ) );
201201fputs (PQerrormsg ,stderr );
202202pqdebug ("%s" ,PQerrormsg );
203203return STATUS_ERROR ;
@@ -211,8 +211,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
211211sizeof (one )))== -1 )
212212{
213213snprintf (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 ) );
216216fputs (PQerrormsg ,stderr );
217217pqdebug ("%s" ,PQerrormsg );
218218return STATUS_ERROR ;
@@ -265,8 +265,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
265265if (err < 0 )
266266{
267267snprintf (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 ) );
270270strcat (PQerrormsg ,
271271"\tIs another postmaster already running on that port?\n" );
272272if (family == AF_UNIX )
@@ -281,6 +281,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
281281strcat (PQerrormsg ,"\tIf not, wait a few seconds and retry.\n" );
282282}
283283fputs (PQerrormsg ,stderr );
284+ pqdebug ("%s" ,PQerrormsg );
284285return STATUS_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 ));
445447return EOF ;
446448}
447449if (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 */