| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Andrew Chernow <ac(at)esilo(dot)com> |
| Cc: | Tim Hawes <thawes(at)novadine(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: C Extension woes |
| Date: | 2008-08-13 14:34:26 |
| Message-ID: | 18797.1218638066@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Andrew Chernow <ac(at)esilo(dot)com> writes:
> Tim Hawes wrote:
>> char *e_var = getenv("PGMASTERKEY");
>> size_t length = VARSIZE(e_var) - VARHDRSZ;
> The VARSIZE macro is for variable length structures, like a text or
> bytea which contains a length and data member. You are using this macro
> on a regular C string "e_var".
The code on the output side is wrong too: if the useful data length is
"length", then the palloc has to ask for length + VARHDRSZ, and that's
also what's got to be put into the length word.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Nacos | 2008-08-13 14:38:05 | Re: Overhauling GUCS |
| Previous Message | Magnus Hagander | 2008-08-13 14:26:27 | Re: Replay attack of query cancel |