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