mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-30 19:00:29 +08:00
Someone report me small bug in contrib/pg_dumplo today. It's problem
with a little dirty snprintf() usage which I used some years ago: snprintf(path, BUFSIZ, "%s/lo_dump.index", path); Karel Zak
This commit is contained in:
parent
6687152582
commit
1dad866bb4
@ -1,7 +1,7 @@
|
|||||||
/* -------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------
|
||||||
* pg_dumplo
|
* pg_dumplo
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/utils.c,v 1.6 2002/09/05 21:01:16 tgl Exp $
|
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/utils.c,v 1.7 2003/10/09 13:38:05 momjian Exp $
|
||||||
*
|
*
|
||||||
* Karel Zak 1999-2000
|
* Karel Zak 1999-2000
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
@ -30,6 +30,7 @@ void
|
|||||||
index_file(LODumpMaster * pgLO)
|
index_file(LODumpMaster * pgLO)
|
||||||
{
|
{
|
||||||
char path[BUFSIZ];
|
char path[BUFSIZ];
|
||||||
|
int sz;
|
||||||
|
|
||||||
if (pgLO->action == ACTION_SHOW)
|
if (pgLO->action == ACTION_SHOW)
|
||||||
return;
|
return;
|
||||||
@ -49,7 +50,8 @@ index_file(LODumpMaster * pgLO)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(path, BUFSIZ, "%s/lo_dump.index", path);
|
sz = strlen(path);
|
||||||
|
strncat(path, "/lo_dump.index", BUFSIZ-sz);
|
||||||
|
|
||||||
if ((pgLO->index = fopen(path, "w")) == NULL)
|
if ((pgLO->index = fopen(path, "w")) == NULL)
|
||||||
{
|
{
|
||||||
@ -60,8 +62,8 @@ index_file(LODumpMaster * pgLO)
|
|||||||
}
|
}
|
||||||
else if (pgLO->action != ACTION_NONE)
|
else if (pgLO->action != ACTION_NONE)
|
||||||
{
|
{
|
||||||
|
sz = strlen(path);
|
||||||
snprintf(path, BUFSIZ, "%s/lo_dump.index", path);
|
strncat(path, "/lo_dump.index", BUFSIZ-sz);
|
||||||
|
|
||||||
if ((pgLO->index = fopen(path, "r")) == NULL)
|
if ((pgLO->index = fopen(path, "r")) == NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user