aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index b17d37b674d..782c161c23a 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.40 2000/11/26 11:09:32 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.41 2000/11/27 02:20:36 tgl Exp $
*/
#include "postgres.h"
#include "command.h"
@@ -1236,7 +1236,8 @@ do_connect(const char *new_dbname, const char *new_user)
NULL, NULL, dbparam, userparam, pwparam);
if (PQstatus(pset.db) == CONNECTION_BAD &&
- strcmp(PQerrorMessage(pset.db), "fe_sendauth: no password supplied\n") == 0)
+ strcmp(PQerrorMessage(pset.db), "fe_sendauth: no password supplied\n") == 0 &&
+ !feof(stdin))
{
PQfinish(pset.db);
need_pass = true;
@@ -1491,7 +1492,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
char line[1024];
resetPQExpBuffer(query_buf);
- while (fgets(line, 1024, stream))
+ while (fgets(line, sizeof(line), stream) != NULL)
appendPQExpBufferStr(query_buf, line);
if (ferror(stream))