aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/prompt.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-04-30 17:09:13 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-04-30 17:09:13 +0000
commit09543580471182ecab3b73c982485397edabbce2 (patch)
treeb622ef3f45302ca9129bd04b67ef7be7ac85ea35 /src/bin/psql/prompt.c
parent21992dd4f5165692dcf039b3ed192a759dcc4f2c (diff)
downloadpostgresql-09543580471182ecab3b73c982485397edabbce2.tar.gz
postgresql-09543580471182ecab3b73c982485397edabbce2.zip
Fix a couple of places where the result of fgets() wasn't checked.
This is mostly to suppress compiler warnings, although in principle the cases could result in undesirable behavior. Martin Pitt
Diffstat (limited to 'src/bin/psql/prompt.c')
-rw-r--r--src/bin/psql/prompt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c
index 487ab2804e5..b08234b7814 100644
--- a/src/bin/psql/prompt.c
+++ b/src/bin/psql/prompt.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/prompt.c,v 1.53 2010/01/02 16:57:59 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/prompt.c,v 1.54 2010/04/30 17:09:13 tgl Exp $
*/
#include "postgres_fe.h"
@@ -252,7 +252,8 @@ get_prompt(promptStatus_t status)
fd = popen(file, "r");
if (fd)
{
- fgets(buf, sizeof(buf), fd);
+ if (fgets(buf, sizeof(buf), fd) == NULL)
+ buf[0] = '\0';
pclose(fd);
}
if (strlen(buf) > 0 && buf[strlen(buf) - 1] == '\n')