Commit 63481f0b authored by Bryan Henderson's avatar Bryan Henderson

Use strncpy() and local buffers instead of snprintf(), since not everyone

has snprintf().
parent aa1eac79
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.16 1996/10/24 07:55:07 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.17 1996/10/28 09:05:29 bryanh Exp $
* *
* NOTES * NOTES
* *
...@@ -598,20 +598,23 @@ ConnStartup(Port *port, int *status, ...@@ -598,20 +598,23 @@ ConnStartup(Port *port, int *status,
(void) strncpy(namebuf, sp.user, NAMEDATALEN); (void) strncpy(namebuf, sp.user, NAMEDATALEN);
namebuf[NAMEDATALEN] = '\0'; namebuf[NAMEDATALEN] = '\0';
if (!namebuf[0]) { if (!namebuf[0]) {
snprintf(errormsg, errormsg_len, strncpy(errormsg,
"No Postgres username specified in startup packet."); "No Postgres username specified in startup packet.",
errormsg_len);
*status = STATUS_ERROR; *status = STATUS_ERROR;
} else { } else {
if (be_recvauth(msgType, port, namebuf, &sp) != STATUS_OK) { if (be_recvauth(msgType, port, namebuf, &sp) != STATUS_OK) {
snprintf(errormsg, errormsg_len, char buffer[200 + sizeof(namebuf)];
"Failed to authenticate client as Postgres user '%s' " sprintf(buffer,
"using authentication scheme %d.", "Failed to authenticate client as Postgres user '%s' "
namebuf, msgType); "using authentication scheme %d.",
namebuf, msgType);
strncpy(errormsg, buffer, errormsg_len);
*status = STATUS_ERROR; *status = STATUS_ERROR;
} else { } else {
if (BackendStartup(&sp, port, &pid) != STATUS_OK) { if (BackendStartup(&sp, port, &pid) != STATUS_OK) {
snprintf(errormsg, errormsg_len, strncpy(errormsg, "Startup (fork) of backend failed.",
"Startup (fork) of backend failed."); errormsg_len);
*status = STATUS_ERROR; *status = STATUS_ERROR;
} else { } else {
errormsg[0] = '\0'; /* just for robustness */ errormsg[0] = '\0'; /* just for robustness */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment