Re: Looking for someone with MinGW - Mailing list pgsql-hackers

From ITAGAKI Takahiro
Subject Re: Looking for someone with MinGW
Date
Msg-id 20081217112347.8A3F.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Re: Looking for someone with MinGW  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Looking for someone with MinGW
Re: Looking for someone with MinGW
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> wrote:

> > Thanks. The backtrace is kind of strange, but I might have found it.
> > Could you please update from CVS and re-run?
>
> same result ;-(

Hi, I found the cause.

Segfault comes from the following lines.
[ecpg/test/connect/test1.pgc]
    exec sql connect to tcp:postgresql://localhost/ user connectdb;
    exec sql disconnect;

-> ECPGdisconnect()
    -> ecpg_finish()
        -> ecpg_log("ecpg_finish: connection %s closed\n", act->name);
<HERE>      -> vfprintf(debugstream, fmt, ap);

Actual error occurs in vfprintf() because act->name can be NULL.
sprintf(..., "%s", NULL) could work on some platform (the result is '(null)'),
but it crashes on Windows (msvcrt). We need to avoid passing NULLs as
arguments to "%s" format for printf families.

The attached patch fixes the segfault. Regression tests can finish
successfully but there is still a difference. The diff seems to be
trivial and come from error message changes.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Attachment

pgsql-hackers by date:

Previous
From: "Fujii Masao"
Date:
Subject: Re: Sync Rep: First Thoughts on Code
Next
From: Tom Lane
Date:
Subject: Re: Looking for someone with MinGW