*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.6 1997/03/18 21:29:21 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.7 1997/04/17 20:39:31 scrappy Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
int nbytes, tmp;
#define BUFSIZE 1024
char buf[BUFSIZE];
+ char fnamebuf[8192];
LargeObjectDesc *lobj;
Oid lobjOid;
/*
* open the file to be read in
*/
- fd = open(VARDATA(filename), O_RDONLY, 0666);
+ strncpy(fnamebuf, VARDATA(filename), VARSIZE(filename));
+ fnamebuf[VARSIZE(filename)] = '\0';
+ fd = open(fnamebuf, O_RDONLY, 0666);
if (fd < 0) { /* error */
elog(WARN, "lo_import: can't open unix file\"%s\"\n",
- VARDATA(filename));
+ fnamebuf);
}
/*
lobj = inv_create(INV_READ|INV_WRITE);
if (lobj == NULL) {
elog(WARN, "lo_import: can't create inv object for \"%s\"",
- VARDATA(filename));
+ fnamebuf);
}
/*
tmp = inv_write(lobj, buf, nbytes);
if (tmp < nbytes) {
elog(WARN, "lo_import: error while reading \"%s\"",
- VARDATA(filename));
+ fnamebuf);
}
}
int nbytes, tmp;
#define BUFSIZE 1024
char buf[BUFSIZE];
+ char fnamebuf[8192];
LargeObjectDesc *lobj;
mode_t oumask;
* open the file to be written to
*/
oumask = umask((mode_t) 0);
- fd = open(VARDATA(filename), O_CREAT|O_WRONLY, 0666);
+ strncpy(fnamebuf, VARDATA(filename), VARSIZE(filename));
+ fnamebuf[VARSIZE(filename)] = '\0';
+ fd = open(fnamebuf, O_CREAT|O_WRONLY, 0666);
(void) umask(oumask);
if (fd < 0) { /* error */
elog(WARN, "lo_export: can't open unix file\"%s\"",
- VARDATA(filename));
+ fnamebuf);
}
/*
tmp = write(fd, buf, nbytes);
if (tmp < nbytes) {
elog(WARN, "lo_export: error while writing \"%s\"",
- VARDATA(filename));
+ fnamebuf);
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.30 1997/04/16 06:29:19 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.31 1997/04/17 20:39:23 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
* Setup the conn structure
* ----------
*/
+ conn->lobjfuncs = (PGlobjfuncs *) NULL;
conn->Pfout = NULL;
conn->Pfin = NULL;
conn->Pfdebug = NULL;