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

Commit4550096

Browse files
committed
StreamConnection() mustn't call elog().
1 parentb1134e3 commit4550096

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎src/backend/libpq/pqcomm.c

Lines changed: 9 additions & 5 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.82 1999/08/31 04:26:37 tgl Exp $
31+
*$Id: pqcomm.c,v 1.83 1999/09/08 22:57:12 tgl Exp $
3232
*
3333
*-------------------------------------------------------------------------
3434
*/
@@ -335,6 +335,10 @@ StreamServerPort(char *hostName, unsigned short portName, int *fdP)
335335
*the Postmaster uses select() to tell when the server master
336336
*socket is ready for accept().
337337
*
338+
* NB: this can NOT call elog() because it is invoked in the postmaster,
339+
* not in standard backend context. If we get an error, the best we can do
340+
* is log it to stderr.
341+
*
338342
* RETURNS: STATUS_OK or STATUS_ERROR
339343
*/
340344
int
@@ -348,7 +352,7 @@ StreamConnection(int server_fd, Port *port)
348352
(structsockaddr*)&port->raddr,
349353
&addrlen))<0)
350354
{
351-
elog(ERROR,"postmaster: StreamConnection: accept: %m");
355+
perror("postmaster: StreamConnection: accept");
352356
returnSTATUS_ERROR;
353357
}
354358

@@ -357,7 +361,7 @@ StreamConnection(int server_fd, Port *port)
357361
if (getsockname(port->sock, (structsockaddr*)&port->laddr,
358362
&addrlen)<0)
359363
{
360-
elog(ERROR,"postmaster: StreamConnection: getsockname: %m");
364+
perror("postmaster: StreamConnection: getsockname");
361365
returnSTATUS_ERROR;
362366
}
363367

@@ -370,13 +374,13 @@ StreamConnection(int server_fd, Port *port)
370374
pe=getprotobyname("TCP");
371375
if (pe==NULL)
372376
{
373-
elog(ERROR,"postmaster:getprotobyname failed");
377+
perror("postmaster:StreamConnection: getprotobyname");
374378
returnSTATUS_ERROR;
375379
}
376380
if (setsockopt(port->sock,pe->p_proto,TCP_NODELAY,
377381
&on,sizeof(on))<0)
378382
{
379-
elog(ERROR,"postmaster:setsockopt failed: %m");
383+
perror("postmaster:StreamConnection: setsockopt");
380384
returnSTATUS_ERROR;
381385
}
382386
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp