Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb4d9f4

Browse files
committed
Do not refer to stdin in static variable initializer ...
apparently some systems choke on that :-(.
1 parent c8cc45b commit eb4d9f4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/bin/psql/psql.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.177 1999/05/03 19:10:08 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.178 1999/05/12 23:26:03 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -149,7 +149,7 @@ typedef struct _psqlSettings
149149
* of passing them around through many function parameter lists seems
150150
* worse.
151151
*/
152-
static FILE * cur_cmd_source = stdin; /* current source of command input */
152+
static FILE * cur_cmd_source = NULL; /* current source of command input */
153153
static bool cur_cmd_interactive = false; /* is it an interactive source? */
154154

155155

@@ -2817,6 +2817,12 @@ main(int argc, char **argv)
28172817
char *home = NULL; /* Used to store $HOME */
28182818
char *version = NULL; /* PostgreSQL version */
28192819

2820+
/* initialize cur_cmd_source in case we do not use MainLoop ...
2821+
* some systems fail if we try to use a static initializer for this :-(
2822+
*/
2823+
cur_cmd_source = stdin;
2824+
cur_cmd_interactive = false;
2825+
28202826
MemSet(&settings, 0, sizeof settings);
28212827
settings.opt.align = 1;
28222828
settings.opt.header = 1;

0 commit comments

Comments
 (0)