Fix bug in pg_dump and psql (to reproduce the bug, just try pg_dump
authorTatsuo Ishii <[email protected]>
Tue, 14 May 2002 02:08:22 +0000 (02:08 +0000)
committerTatsuo Ishii <[email protected]>
Tue, 14 May 2002 02:08:22 +0000 (02:08 +0000)
--nonexistingoption).

per report from [email protected] on Thu, 09 May 2002 11:57:51 +0900
(JST) at pgsql-patches list.

Illegal long options to pg_dump makes core on some systems, since it
lacks the last null sentinel of struct option array.

Attached is a patch made by Mr. Ishida Akio <[email protected]>.

src/bin/pg_dump/pg_dump.c
src/bin/psql/startup.c

index 432c6ae6fb0326823296db4cfc553b66f2afc72b..e75d667aaeb98ef499ed8efe67a5ea7d8d45516e 100644 (file)
@@ -701,7 +701,8 @@ main(int argc, char **argv)
                 * the following options don't have an equivalent short option
                 * letter, but are available as '-X long-name'
                 */
-               {"use-set-session-authorization", no_argument, &use_setsessauth, 1}
+               {"use-set-session-authorization", no_argument, &use_setsessauth, 1},
+               {NULL, 0, NULL, 0}
        };
        int                     optindex;
 #endif
index cef4f26a68955ab413f5558cc073b96bd3a13a4a..1be2060b471b29fb140fd10484ad76df6d82cf94 100644 (file)
@@ -361,6 +361,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
                {"expanded", no_argument, NULL, 'x'},
                {"no-psqlrc", no_argument, NULL, 'X'},
                {"help", no_argument, NULL, '?'},
+               {NULL, 0, NULL, 0}
        };
 
        int                     optindex;