]> granicus.if.org Git - postgresql/commitdiff
Fix intoasc() in Informix compat lib. This function used to be a noop.
authorMichael Meskes <meskes@postgresql.org>
Fri, 12 Jun 2015 12:50:47 +0000 (14:50 +0200)
committerMichael Meskes <meskes@postgresql.org>
Sat, 13 Jun 2015 09:18:31 +0000 (11:18 +0200)
Patch by Michael Paquier

src/interfaces/ecpg/compatlib/informix.c

index 92e2a5269a70251840e38a471cc11bf2b28c3c30..730c7913cd1c9ae8cd70f88d8e0f9d464c13ea9b 100644 (file)
@@ -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;
 }