1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

Fix pgproc names over 15 chars in output. Add strNcpy() function. remove some (void) casts that are unnecessary.

This commit is contained in:
Bruce Momjian
1997-08-12 20:16:25 +00:00
parent 4b851b1cfc
commit edb58721b8
44 changed files with 163 additions and 192 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.11 1997/03/25 00:54:15 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.12 1997/08/12 20:15:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -302,10 +302,10 @@ pg_krb5_recvauth(int sock,
* easy, we construct our own name and parse it. See note on
* canonicalization above.
*/
(void) strcpy(servbuf, PG_KRB_SRVNAM);
strcpy(servbuf, PG_KRB_SRVNAM);
*(hostp = servbuf + (sizeof(PG_KRB_SRVNAM) - 1)) = '/';
if (gethostname(++hostp, MAXHOSTNAMELEN) < 0)
(void) strcpy(hostp, "localhost");
strcpy(hostp, "localhost");
if (hostp = strchr(hostp, '.'))
*hostp = '\0';
if (code = krb5_parse_name(servbuf, &server)) {

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.10 1997/06/10 13:01:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.11 1997/08/12 20:15:18 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
@@ -257,8 +257,7 @@ lo_import(text *filename)
/*
* open the file to be read in
*/
strncpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ);
fnamebuf[VARSIZE(filename) - VARHDRSZ] = '\0';
strNcpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ);
fd = open(fnamebuf, O_RDONLY, 0666);
if (fd < 0) { /* error */
elog(WARN, "be_lo_import: can't open unix file\"%s\"\n",
@@ -325,8 +324,7 @@ lo_export(Oid lobjId, text *filename)
* open the file to be written to
*/
oumask = umask((mode_t) 0);
strncpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ);
fnamebuf[VARSIZE(filename) - VARHDRSZ] = '\0';
strNcpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ);
fd = open(fnamebuf, O_CREAT|O_WRONLY, 0666);
(void) umask(oumask);
if (fd < 0) { /* error */

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.2 1996/11/06 08:48:26 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.3 1997/08/12 20:15:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -223,7 +223,7 @@ strmake(char *str, int len)
if (len <= 0) len = strlen(str);
newstr = (char *) palloc((unsigned) len+1);
(void) strncpy(newstr, str, len);
strNcpy(newstr, str, len);
newstr[len] = (char) 0;
return newstr;
}

View File

@@ -80,8 +80,7 @@ verify_password(char *user, char *password, Port *port,
/* kill the newline */
test_pw[strlen(test_pw)-1] = '\0';
strncpy(salt, test_pw, 2);
salt[2] = '\0';
strNcpy(salt, test_pw, 2);
if(strcmp(user, test_user) == 0) {
/* we're outta here one way or the other. */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.4 1996/11/06 08:48:28 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.5 1997/08/12 20:15:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -144,7 +144,7 @@ PQpnames(char **pnames, int rule_p)
for (i = 0; i < portals_array_size; ++i) {
if (portals[i] && portals[i]->portal) {
if (!rule_p || portals[i]->portal->rule_p) {
(void) strncpy(pnames[cur_pname], portals[i]->name, PortalNameLength);
strncpy(pnames[cur_pname], portals[i]->name, PortalNameLength);
++cur_pname;
}
}
@@ -710,7 +710,7 @@ PQappendNotify(char *relname, int pid)
pqNotifyList = DLNewList();
p = (PQNotifyList*)pbuf_alloc(sizeof(PQNotifyList));
strncpy(p->relname, relname, NAMEDATALEN);
strNcpy(p->relname, relname, NAMEDATALEN-1);
p->be_pid = pid;
p->valid = 1;
DLAddTail(pqNotifyList, DLNewElem(p));

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.3 1996/11/06 08:48:29 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.4 1997/08/12 20:15:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -377,8 +377,7 @@ void
pbuf_setportalinfo(PortalEntry *entry, char *pname)
{
if (entry)
strncpy(entry->name, pname, PortalNameLength-1);
entry->name[PortalNameLength-1] = '\0';
strNcpy(entry->name, pname, PortalNameLength-1);
}
/* --------------------------------

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.17 1997/07/28 00:54:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.18 1997/08/12 20:15:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -113,7 +113,7 @@ pq_getc(FILE* fin)
void
pq_gettty(char *tp)
{
(void) strncpy(tp, ttyname(0), 19);
strncpy(tp, ttyname(0), 19);
}
/* --------------------------------
@@ -585,8 +585,8 @@ StreamServerPort(char *hostName, short portName, int *fdP)
"FATAL: StreamServerPort: bind() failed: errno=%d\n",
errno);
pqdebug("%s", PQerrormsg);
(void) strcat(PQerrormsg, "\tIs another postmaster already running on that port?\n");
(void) strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n");
strcat(PQerrormsg, "\tIs another postmaster already running on that port?\n");
strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n");
fputs(PQerrormsg, stderr);
return(STATUS_ERROR);
}