[4/5] ntdll: Don't do further calls to pf_output_stringA if previous call failed

Sebastian Lackner sebastian at fds-team.de
Fri Dec 20 00:47:26 CST 2013


Without an additional check of r the previous value is overwritten
(which could return a wrong error code, when there are probably multiple
ones implemented in the future, currently it shouldn't have any effect).
The rest of the code also checks this everywhere, so at my opinion it
also makes sense to add it here.

---
 dlls/ntdll/printf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-------------- next part --------------
From 8a083b0b4beae1b5f737ec35ba73415ebdb1739e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian at fds-team.de>
Date: Fri, 20 Dec 2013 05:59:41 +0100
Subject: ntdll: Don't do further calls to pf_output_stringA if previous call
 failed

---
 dlls/ntdll/printf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/printf.c b/dlls/ntdll/printf.c
index 6c904cc..9bcd42f 100644
--- a/dlls/ntdll/printf.c
+++ b/dlls/ntdll/printf.c
@@ -180,7 +180,7 @@ static inline int pf_fill( pf_output *out, int len, pf_flags *flags, char left )
         }
     }
 
-    if( left && flags->Sign && !flags->PadZero )
+    if (left && flags->Sign && !flags->PadZero && (r>=0))
         r = pf_output_stringA( out, &flags->Sign, 1 );
 
     return r;
-- 
1.7.9.5



More information about the wine-patches mailing list