Fix intoasc() in Informix compat lib. This function used to be a noop.
authorMichael Meskes <[email protected]>
Fri, 12 Jun 2015 12:50:47 +0000 (14:50 +0200)
committerMichael Meskes <[email protected]>
Sat, 13 Jun 2015 09:13:59 +0000 (11:13 +0200)
Patch by Michael Paquier

src/interfaces/ecpg/compatlib/informix.c

index 3b30864866bfb676f60ea1e70d9f9bc2cd662d50..fdd175983e14d7f99e69d3d643d1f306d8c91920 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;
 }