From: Michael Meskes Date: Fri, 12 Jun 2015 12:50:47 +0000 (+0200) Subject: Fix intoasc() in Informix compat lib. This function used to be a noop. X-Git-Tag: REL9_1_19~109 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=866e7f591550929991d1cc683c4a3faa74263036;p=postgresql Fix intoasc() in Informix compat lib. This function used to be a noop. Patch by Michael Paquier --- diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index 3b30864866..fdd175983e 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -667,12 +667,16 @@ dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr) int intoasc(interval * i, char *str) { + char *tmp; + errno = 0; - str = PGTYPESinterval_to_asc(i); + tmp = PGTYPESinterval_to_asc(i); - if (!str) + if (!tmp) return -errno; + memcpy(str, tmp, strlen(tmp)); + free(tmp); return 0; }