Fix uninitialized memory bug
Add support for PGHOST, PGPORT, PGUSER environment variables
This commit is contained in:
parent
cdfb3d9981
commit
412893b416
@ -164,6 +164,10 @@ Basically it is same as BSD license. See pgbench.c for more details.
|
||||
|
||||
o History
|
||||
|
||||
2003/06/10
|
||||
* fix uninitialized memory bug
|
||||
* add support for PGHOST, PGPORT, PGUSER environment variables
|
||||
|
||||
2002/07/20
|
||||
* patch contributed by Neil Conway.
|
||||
* code/document clean up and add -l option.
|
||||
|
@ -184,6 +184,10 @@ pgbench $B$O@P0f(B $BC#IW$K$h$C$F=q$+$l$^$7$?!%%i%$%;%s%9>r7o$O(B pgbench.c
|
||||
|
||||
$B"#2~DjMzNr(B
|
||||
|
||||
2003/06/10
|
||||
* $B%a%b%j$,=i4|2=$5$l$F$$$J$$%P%0$r=$@5(B
|
||||
* $B4D6-JQ?t(BPGHOST, PGPORT, PGUSER$B$rG'<1$9$k$h$&$K$7$?!%(B
|
||||
|
||||
2002/07/20
|
||||
* Nei Conway$B$5$s$N%Q%C%A$rE,MQ!%(B
|
||||
* -l $B%*%W%7%g%s$NDI2C!%(B
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.23 2003/05/14 03:25:56 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.24 2003/06/10 09:07:15 ishii Exp $
|
||||
*
|
||||
* pgbench: a simple TPC-B like benchmark program for PostgreSQL
|
||||
* written by Tatsuo Ishii
|
||||
@ -694,6 +694,14 @@ main(int argc, char **argv)
|
||||
|
||||
PGconn *con;
|
||||
PGresult *res;
|
||||
char *env;
|
||||
|
||||
if ((env = getenv("PGHOST")) != NULL && *env != '\0')
|
||||
pghost = env;
|
||||
if ((env = getenv("PGPORT")) != NULL && *env != '\0')
|
||||
pgport = env;
|
||||
else if ((env = getenv("PGUSER")) != NULL && *env != '\0')
|
||||
login = env;
|
||||
|
||||
while ((c = getopt(argc, argv, "ih:nvp:dc:t:s:U:P:CNSl")) != -1)
|
||||
{
|
||||
@ -788,8 +796,11 @@ main(int argc, char **argv)
|
||||
dbName = argv[optind];
|
||||
else
|
||||
{
|
||||
dbName = getenv("USER");
|
||||
if (dbName == NULL)
|
||||
if ((env = getenv("PGDATABASE")) != NULL && *env != '\0')
|
||||
dbName = env;
|
||||
else if (login != NULL && *login != '\0')
|
||||
dbName = login;
|
||||
else
|
||||
dbName = "";
|
||||
}
|
||||
|
||||
@ -802,7 +813,7 @@ main(int argc, char **argv)
|
||||
remains = nclients;
|
||||
|
||||
state = (CState *) malloc(sizeof(*state) * nclients);
|
||||
memset(state, 0, sizeof(*state));
|
||||
memset(state, 0, sizeof(*state) * nclients);
|
||||
|
||||
if (use_log)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user