|
30 | 30 | * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
31 | 31 | * Portions Copyright (c) 1994, Regents of the University of California
|
32 | 32 | *
|
33 |
| - *$Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.164 2003/08/07 19:37:13 tgl Exp $ |
| 33 | + *$Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.165 2003/08/12 22:42:01 tgl Exp $ |
34 | 34 | *
|
35 | 35 | *-------------------------------------------------------------------------
|
36 | 36 | */
|
@@ -209,7 +209,9 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
|
209 | 209 | intmaxconn;
|
210 | 210 | intone=1;
|
211 | 211 | intret;
|
212 |
| -charportNumberStr[64]; |
| 212 | +charportNumberStr[32]; |
| 213 | +constchar*familyDesc; |
| 214 | +charfamilyDescBuf[64]; |
213 | 215 | char*service;
|
214 | 216 | structaddrinfo*addrs=NULL,
|
215 | 217 | *addr;
|
@@ -276,11 +278,37 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
|
276 | 278 | break;
|
277 | 279 | }
|
278 | 280 |
|
| 281 | +/* set up family name for possible error messages */ |
| 282 | +switch (addr->ai_family) |
| 283 | +{ |
| 284 | +caseAF_INET: |
| 285 | +familyDesc=gettext("IPv4"); |
| 286 | +break; |
| 287 | +#ifdefHAVE_IPV6 |
| 288 | +caseAF_INET6: |
| 289 | +familyDesc=gettext("IPv6"); |
| 290 | +break; |
| 291 | +#endif |
| 292 | +#ifdefHAVE_UNIX_SOCKETS |
| 293 | +caseAF_UNIX: |
| 294 | +familyDesc=gettext("Unix"); |
| 295 | +break; |
| 296 | +#endif |
| 297 | +default: |
| 298 | +snprintf(familyDescBuf,sizeof(familyDescBuf), |
| 299 | +gettext("unrecognized address family %d"), |
| 300 | +addr->ai_family); |
| 301 | +familyDesc=familyDescBuf; |
| 302 | +break; |
| 303 | +} |
| 304 | + |
279 | 305 | if ((fd=socket(addr->ai_family,SOCK_STREAM,0))<0)
|
280 | 306 | {
|
281 | 307 | ereport(LOG,
|
282 | 308 | (errcode_for_socket_access(),
|
283 |
| -errmsg("failed to create socket: %m"))); |
| 309 | +/* translator: %s is IPv4, IPv6, or Unix */ |
| 310 | +errmsg("could not create %s socket: %m", |
| 311 | +familyDesc))); |
284 | 312 | continue;
|
285 | 313 | }
|
286 | 314 |
|
@@ -323,7 +351,9 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
|
323 | 351 | {
|
324 | 352 | ereport(LOG,
|
325 | 353 | (errcode_for_socket_access(),
|
326 |
| -errmsg("failed to bind server socket: %m"), |
| 354 | +/* translator: %s is IPv4, IPv6, or Unix */ |
| 355 | +errmsg("could not bind %s socket: %m", |
| 356 | +familyDesc), |
327 | 357 | (IS_AF_UNIX(addr->ai_family)) ?
|
328 | 358 | errhint("Is another postmaster already running on port %d?"
|
329 | 359 | " If not, remove socket node \"%s\" and retry.",
|
@@ -361,7 +391,9 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
|
361 | 391 | {
|
362 | 392 | ereport(LOG,
|
363 | 393 | (errcode_for_socket_access(),
|
364 |
| -errmsg("failed to listen on server socket: %m"))); |
| 394 | +/* translator: %s is IPv4, IPv6, or Unix */ |
| 395 | +errmsg("could not listen on %s socket: %m", |
| 396 | +familyDesc))); |
365 | 397 | closesocket(fd);
|
366 | 398 | continue;
|
367 | 399 | }
|
|