From 82be1bf5099c0f6d1ef482ba3ca9cf1741db1eb3 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Fri, 12 Jun 2015 14:50:47 +0200 Subject: [PATCH] Fix intoasc() in Informix compat lib. This function used to be a noop. Patch by Michael Paquier --- src/interfaces/ecpg/compatlib/informix.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index d6de3eac99..8d81c83ded 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -666,12 +666,16 @@ dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr) int intoasc(interval * i, char *str) { - errno = 0; - str = PGTYPESinterval_to_asc(i); + char *tmp; - if (!str) + errno = 0; + tmp = PGTYPESinterval_to_asc(i); + + if (!tmp) return -errno; + memcpy(str, tmp, strlen(tmp)); + free(tmp); return 0; }