]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(vfprintf): Fix the remaining premature returns without cleaning up the lock.
authorUlrich Drepper <drepper@redhat.com>
Thu, 29 Oct 1998 20:38:21 +0000 (20:38 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 29 Oct 1998 20:38:21 +0000 (20:38 +0000)
(printf_unknown): Add label all_done.

stdio-common/vfprintf.c

index 0bcb1174927aea03a79884cc9e7cd11f2712a558..cae92a04104755faeb123cdf505d7a34aaed8fe8 100644 (file)
@@ -53,7 +53,11 @@ ssize_t __printf_pad __P ((FILE *, char pad, size_t n));
 # define PAD(Padchar)                                                        \
   if (width > 0)                                                             \
     { ssize_t __res = __printf_pad (s, (Padchar), width);                    \
-      if (__res == -1) return -1;                                            \
+      if (__res == -1)                                                       \
+       {                                                                     \
+         done = -1;                                                          \
+         goto all_done;                                                      \
+       }                                                                     \
       done += __res; }
 # endif
 #else
@@ -75,7 +79,11 @@ ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n));
 #  define PAD(Padchar)                                                       \
   if (width > 0)                                                             \
     { ssize_t __res = __wprintf_pad (s, (Padchar), width);                   \
-      if (__res == -1) return -1;                                            \
+      if (__res == -1)                                                       \
+       {                                                                     \
+         done = -1;                                                          \
+         goto all_done;                                                      \
+       }                                                                     \
       done += __res; }
 # endif
 #endif
@@ -150,7 +158,10 @@ extern void __funlockfile (FILE *);
     {                                                                        \
       register const int outc = (Ch);                                        \
       if (PUTC (outc, s) == EOF)                                             \
-       return -1;                                                            \
+       {                                                                     \
+         done = -1;                                                          \
+         goto all_done;                                                      \
+       }                                                                     \
       else                                                                   \
        ++done;                                                               \
     }                                                                        \
@@ -160,7 +171,10 @@ extern void __funlockfile (FILE *);
   do                                                                         \
     {                                                                        \
       if ((size_t) PUT (s, (String), (Len)) != (size_t) (Len))               \
-       return -1;                                                            \
+       {                                                                     \
+         done = -1;                                                          \
+         goto all_done;                                                      \
+       }                                                                     \
       done += (Len);                                                         \
     }                                                                        \
   while (0)
@@ -701,8 +715,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
          }                                                                   \
                                                                              \
        if (function_done < 0)                                                \
-         /* Error in print handler.  */                                      \
-         return -1;                                                          \
+         {                                                                   \
+           /* Error in print handler.  */                                    \
+           done = -1;                                                        \
+           goto all_done;                                                    \
+         }                                                                   \
                                                                              \
        done += function_done;                                                \
       }                                                                              \
@@ -786,8 +803,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
                                                                              \
            len = __wcsrtombs (NULL, &s2, 0, &mbstate);                       \
            if (len == (size_t) -1)                                           \
-             /* Illegal wide-character string.  */                           \
-             return -1;                                                      \
+             {                                                               \
+               /* Illegal wide-character string.  */                         \
+               done = -1;                                                    \
+               goto all_done;                                                \
+             }                                                               \
                                                                              \
            s2 = (const wchar_t *) string;                                    \
            string = alloca (len + 1);                                        \
@@ -1431,6 +1451,7 @@ printf_unknown (FILE *s, const struct printf_info *info,
   if (info->spec != '\0')
     outchar (info->spec);
 
+ all_done:
   return done;
 }
 \f