summary refs log tree commit diff
path: root/iconv/iconv.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconv/iconv.c')
-rw-r--r--iconv/iconv.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/iconv/iconv.c b/iconv/iconv.c
index ee16d3b091..c1b96164e5 100644
--- a/iconv/iconv.c
+++ b/iconv/iconv.c
@@ -39,9 +39,12 @@ iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
 
   if (inbuf == NULL || *inbuf == NULL)
     {
-      result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf,
-			(unsigned char *) (outstart + *outbytesleft),
-			&converted);
+      if (outbuf == NULL || *outbuf == NULL)
+	result = __gconv (gcd, NULL, NULL, NULL, NULL, &converted);
+      else
+	result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf,
+			  (unsigned char *) (outstart + *outbytesleft),
+			  &converted);
     }
   else
     {