Fix compile errors on Linux.

This commit is contained in:
Takahiro Itagaki 2009-04-23 06:37:29 +00:00
parent 574b6dc296
commit 0c659ed31f
2 changed files with 11 additions and 3 deletions

View File

@ -29,7 +29,7 @@ static void init_cancel_handler(void);
static void on_before_exec(PGconn *conn); static void on_before_exec(PGconn *conn);
static void on_after_exec(void); static void on_after_exec(void);
static void on_interrupt(void); static void on_interrupt(void);
static void on_exit(void); static void on_cleanup(void);
static void exit_or_abort(int exitcode); static void exit_or_abort(int exitcode);
const char *get_user_name(const char *progname); const char *get_user_name(const char *progname);
@ -150,7 +150,7 @@ pgut_getopt(int argc, char **argv)
} }
init_cancel_handler(); init_cancel_handler();
atexit(on_exit); atexit(on_cleanup);
(void) (dbname || (void) (dbname ||
(dbname = getenv("PGDATABASE")) || (dbname = getenv("PGDATABASE")) ||
@ -189,7 +189,12 @@ reconnect(void)
} }
if (PQstatus(conn) == CONNECTION_BAD && if (PQstatus(conn) == CONNECTION_BAD &&
#if PG_VERSION_NUM >= 80300
PQconnectionNeedsPassword(conn) && PQconnectionNeedsPassword(conn) &&
#else
strcmp(PQerrorMessage(conn), PQnoPasswordSupplied) == 0 &&
!feof(stdin) &&
#endif
pwd == NULL) pwd == NULL)
{ {
PQfinish(conn); PQfinish(conn);
@ -360,7 +365,7 @@ on_interrupt(void)
static pqbool in_cleanup = false; static pqbool in_cleanup = false;
static void static void
on_exit(void) on_cleanup(void)
{ {
in_cleanup = true; in_cleanup = true;
pgut_cleanup(false); pgut_cleanup(false);

View File

@ -9,6 +9,9 @@
*/ */
#include "postgres.h" #include "postgres.h"
#include <unistd.h>
#include "access/transam.h" #include "access/transam.h"
#include "access/xact.h" #include "access/xact.h"
#include "catalog/dependency.h" #include "catalog/dependency.h"