Thread: getopt_long patch for pg_dump and psql

getopt_long patch for pg_dump and psql

From
sugita@sra.co.jp
Date:
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 <iakio@pjam.jpweb.net>.

Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /home/mgr/sugita/jobs/cvs-master/pgsql/src/7.2.1/build/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 pg_dump.c
--- src/bin/pg_dump/pg_dump.c    2002/04/08 02:25:37    1.1
+++ src/bin/pg_dump/pg_dump.c    2002/05/09 02:38:25
@@ -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: src/bin/psql/startup.c
===================================================================
RCS file: /home/mgr/sugita/jobs/cvs-master/pgsql/src/7.2.1/build/src/bin/psql/startup.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 startup.c
--- src/bin/psql/startup.c    2002/04/08 02:25:41    1.1
+++ src/bin/psql/startup.c    2002/05/09 02:38:25
@@ -361,6 +361,7 @@ parse_psql_options(int argc, char *argv[
         {"expanded", no_argument, NULL, 'x'},
         {"no-psqlrc", no_argument, NULL, 'X'},
         {"help", no_argument, NULL, '?'},
+        {NULL, 0, NULL, 0}
     };

     int            optindex;

Re: getopt_long patch for pg_dump and psql

From
Tatsuo Ishii
Date:
> 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 <iakio@pjam.jpweb.net>.

Fix committed to 7.2-stable branch. (The patches did not apply to
current).
--
Tatsuo Ishii

Re: getopt_long patch for pg_dump and psql

From
Tom Lane
Date:
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> Fix committed to 7.2-stable branch. (The patches did not apply to
> current).

I fixed the problem in current pg_dump when I saw Sugita's report,
since I was editing those files anyway.  The problem may still exist
in current psql though.

            regards, tom lane

Re: getopt_long patch for pg_dump and psql

From
Tatsuo Ishii
Date:
> Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> > Fix committed to 7.2-stable branch. (The patches did not apply to
> > current).
>
> I fixed the problem in current pg_dump when I saw Sugita's report,
> since I was editing those files anyway.  The problem may still exist
> in current psql though.

Ok, fix for psql(startup.c) committed.
--
Tatsuo Ishii