diff mbox

[kvm-unit-tests,20/32] lib: fix *printf return value

Message ID 20170421005004.137260-21-dmatlack@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Matlack April 21, 2017, 12:49 a.m. UTC
From: Peter Feiner <pfeiner@google.com>

Was returning the number of characters printed plus, incorrectly, one
for the null terminator.

Signed-off-by: Peter Feiner <pfeiner@google.com>
Signed-off-by: David Matlack <dmatlack@google.com>
---
 lib/printf.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Andrew Jones April 21, 2017, 7:21 a.m. UTC | #1
On Thu, Apr 20, 2017 at 05:49:52PM -0700, David Matlack wrote:
> From: Peter Feiner <pfeiner@google.com>
> 
> Was returning the number of characters printed plus, incorrectly, one
> for the null terminator.
> 
> Signed-off-by: Peter Feiner <pfeiner@google.com>
> Signed-off-by: David Matlack <dmatlack@google.com>
> ---
>  lib/printf.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/lib/printf.c b/lib/printf.c
> index cecbeadc4440..aca2920887c1 100644
> --- a/lib/printf.c
> +++ b/lib/printf.c
> @@ -221,7 +221,6 @@ int vsnprintf(char *buf, int size, const char *fmt, va_list va)
>  	}
>      }
>      *s.buffer = 0;
> -    ++s.added;
>      return s.added;
>  }
>  
> -- 
> 2.12.2.816.g2cccc81164-goog
>

Reviewed-by: Andrew Jones <drjones@redhat.com>
diff mbox

Patch

diff --git a/lib/printf.c b/lib/printf.c
index cecbeadc4440..aca2920887c1 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -221,7 +221,6 @@  int vsnprintf(char *buf, int size, const char *fmt, va_list va)
 	}
     }
     *s.buffer = 0;
-    ++s.added;
     return s.added;
 }