On Fri, Apr 30, 2004 at 11:36:36PM -0400, Tom Lane wrote:
> Alvaro Herrera Munoz <alvherre@dcc.uchile.cl> writes:
> > strace'ing the postmaster suggested me that the dbname string in
> > utils/init/postinit.c, the InitPostgres function, is the culprit.
> > In fact, if I apply the following patch to tcop/postgres.c the
> > whole thing stops happening.
>
> > else if (argc - optind == 1)
> > ! dbname = argv[optind];
> > ...
> > else if (argc - optind == 1)
> > ! dbname = pstrdup(argv[optind]);
>
> Surely this is a red herring --- that code path does not even execute
> except in the case of a standalone backend.
Yes, I figured that out later (the normal path uses -p instead). In
fact I then took out the pstrdup() and the fault wasn't happening; so I
recompiled all over again, without the pstrdup and it was back.
I think maybe there's something clobbering argv. I thought about
tracing that with gdb but never got to it. I will do that now and
report back.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El miedo atento y previsor es la madre de la seguridad" (E. Burke)