diff options
| author | Bruce Momjian | 1997-08-12 20:16:25 +0000 |
|---|---|---|
| committer | Bruce Momjian | 1997-08-12 20:16:25 +0000 |
| commit | edb58721b8f7fd76b5dfa3bf83c683f2e266abd3 (patch) | |
| tree | 4f1fe8679d97cb881fe3bcd6a46cf63a50cef1e8 /src/backend/libpq | |
| parent | 4b851b1cfc629a9d3802aa5c22572593663f5fe0 (diff) | |
Fix pgproc names over 15 chars in output. Add strNcpy() function. remove some (void) casts that are unnecessary.
Diffstat (limited to 'src/backend/libpq')
| -rw-r--r-- | src/backend/libpq/auth.c | 6 | ||||
| -rw-r--r-- | src/backend/libpq/be-fsstubs.c | 8 | ||||
| -rw-r--r-- | src/backend/libpq/be-pqexec.c | 4 | ||||
| -rw-r--r-- | src/backend/libpq/password.c | 3 | ||||
| -rw-r--r-- | src/backend/libpq/portal.c | 6 | ||||
| -rw-r--r-- | src/backend/libpq/portalbuf.c | 5 | ||||
| -rw-r--r-- | src/backend/libpq/pqcomm.c | 8 |
7 files changed, 18 insertions, 22 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index b191c03cbff..f325fa0a06a 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -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)) { diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c index f71b5b2892d..c1b36b88948 100644 --- a/src/backend/libpq/be-fsstubs.c +++ b/src/backend/libpq/be-fsstubs.c @@ -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 */ diff --git a/src/backend/libpq/be-pqexec.c b/src/backend/libpq/be-pqexec.c index b880ba71009..031f7ea8a9e 100644 --- a/src/backend/libpq/be-pqexec.c +++ b/src/backend/libpq/be-pqexec.c @@ -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; } diff --git a/src/backend/libpq/password.c b/src/backend/libpq/password.c index 55f77508bbf..555e9c645ec 100644 --- a/src/backend/libpq/password.c +++ b/src/backend/libpq/password.c @@ -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. */ diff --git a/src/backend/libpq/portal.c b/src/backend/libpq/portal.c index e54e18676f8..2ddeab1a701 100644 --- a/src/backend/libpq/portal.c +++ b/src/backend/libpq/portal.c @@ -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)); diff --git a/src/backend/libpq/portalbuf.c b/src/backend/libpq/portalbuf.c index e0390c5ae79..b7a527dcfaf 100644 --- a/src/backend/libpq/portalbuf.c +++ b/src/backend/libpq/portalbuf.c @@ -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); } /* -------------------------------- diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index 8ba16383c28..78767a4a1c4 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -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); } |
