]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
vasnprintf: Don't set errno to 0.
authorBruno Haible <bruno@clisp.org>
Fri, 15 Oct 2010 00:07:02 +0000 (02:07 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 7 Jun 2011 21:38:47 +0000 (23:38 +0200)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/vasnprintf.c
gettext-runtime/libasprintf/ChangeLog
gettext-runtime/libasprintf/vasnprintf.c

index 8a8a5b60e198c9fbe8ac5c45128b65d2e6d65b66..728f3856009ea279f6de2b2e54950e234b29acf3 100644 (file)
@@ -1,3 +1,10 @@
+2010-10-14  Bruno Haible  <bruno@clisp.org>
+
+       vasnprintf: Don't set errno to 0.
+       * vasnprintf.c (VASNPRINTF): Save and restore errno around the block
+       that sets it to 0.
+       Reported by Gianluigi Tiesi <sherpya@netfarm.it>.
+
 2010-06-09  Bruno Haible  <bruno@clisp.org>
 
        Avoid relocwrapper link errors due to gnulib replacement functions.
index 8a07ca6e72da1331e3bf1a741aaa6efbf80085ac..3dd8b3f304b99f78d5408eb281e35f12fc89b198 100644 (file)
@@ -4598,6 +4598,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                 TCHAR_T *fbp;
                 unsigned int prefix_count;
                 int prefixes[2] IF_LINT (= { 0 });
+                int orig_errno;
 #if !USE_SNPRINTF
                 size_t tmp_length;
                 TCHAR_T tmpbuf[700];
@@ -4901,6 +4902,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                 *(TCHAR_T *) (result + length) = '\0';
 #endif
 
+                orig_errno = errno;
+
                 for (;;)
                   {
                     int count = -1;
@@ -5499,6 +5502,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                     length += count;
                     break;
                   }
+                errno = orig_errno;
 #undef pad_ourselves
 #undef prec_ourselves
               }
index e698309151cced00d5c4599e30ebe41efba46ce6..7a13fdfa30818ee7a621dd5093931a5b0a2531df 100644 (file)
@@ -1,3 +1,10 @@
+2010-10-14  Bruno Haible  <bruno@clisp.org>
+
+       vasnprintf: Don't set errno to 0.
+       * vasnprintf.c (VASNPRINTF): Save and restore errno around the block
+       that sets it to 0.
+       Reported by Gianluigi Tiesi <sherpya@netfarm.it>.
+
 2010-06-04  Bruno Haible  <bruno@clisp.org>
 
        * gettext-0.18.1 released.
index 8a07ca6e72da1331e3bf1a741aaa6efbf80085ac..3dd8b3f304b99f78d5408eb281e35f12fc89b198 100644 (file)
@@ -4598,6 +4598,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                 TCHAR_T *fbp;
                 unsigned int prefix_count;
                 int prefixes[2] IF_LINT (= { 0 });
+                int orig_errno;
 #if !USE_SNPRINTF
                 size_t tmp_length;
                 TCHAR_T tmpbuf[700];
@@ -4901,6 +4902,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                 *(TCHAR_T *) (result + length) = '\0';
 #endif
 
+                orig_errno = errno;
+
                 for (;;)
                   {
                     int count = -1;
@@ -5499,6 +5502,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                     length += count;
                     break;
                   }
+                errno = orig_errno;
 #undef pad_ourselves
 #undef prec_ourselves
               }