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

Commit71c1d59

Browse files
author
Bryan Henderson
committed
Remove another snprintf() for Solaris.
1 parent060f1d6 commit71c1d59

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.17 1996/10/28 09:05:29 bryanh Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.18 1996/10/29 21:51:13 bryanh Exp $
1414
*
1515
* NOTES
1616
*
@@ -663,13 +663,19 @@ static void
663663
send_error_reply(Port*port,constchar*errormsg)
664664
{
665665
intrc;/* return code from sendto */
666+
char*reply;
667+
/* The literal reply string we put into the socket. This is a pointer
668+
to storage we malloc.
669+
*/
666670
charreply[201];
667671
conststructlingerlinger_parm= {true,LINGER_TIME};
668672
/* A parameter for setsockopt() that tells it to have close() block for
669673
a while waiting for the frontend to read its outstanding messages.
670674
*/
671675

672-
snprintf(reply,sizeof(reply),"E%s",errormsg);
676+
reply=malloc(strlen(errormsg)+10);
677+
678+
sprintf(reply,"E%s",errormsg);
673679

674680
rc=send(port->sock, (Addr)reply,strlen(reply)+1,/* flags */0);
675681
if (rc<0)
@@ -683,7 +689,8 @@ send_error_reply(Port *port, const char *errormsg)
683689
"Only partial error reply sent to front end.\n",
684690
progname);
685691

686-
/* Now we have to make sure frontend has a chance to see what we
692+
free(reply);
693+
/* Now we have to make sure frontend has a chance to see what we
687694
just wrote.
688695
*/
689696
rc=setsockopt(port->sock,SOL_SOCKET,SO_LINGER,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp