Patchwork [1/2] strtosz() use unsigned char as isspace() is not defined for signed char

login
register
mail settings
Submitter Jes Sorensen
Date Jan. 17, 2011, 3:14 p.m.
Message ID <1295277257-17425-2-git-send-email-Jes.Sorensen@redhat.com>
Download mbox | patch
Permalink /patch/79190/
State New
Headers show

Comments

Jes Sorensen - Jan. 17, 2011, 3:14 p.m.
From: Jes Sorensen <Jes.Sorensen@redhat.com>

Bug pointed out by Eric Blake, thanks!

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 cutils.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Blue Swirl - Jan. 17, 2011, 7:59 p.m.
On Mon, Jan 17, 2011 at 3:14 PM,  <Jes.Sorensen@redhat.com> wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>

This is exactly why we have qemu_isspace().

Patch

diff --git a/cutils.c b/cutils.c
index 7984bc1..f97ef39 100644
--- a/cutils.c
+++ b/cutils.c
@@ -294,7 +294,8 @@  int fcntl_setfl(int fd, int flag)
 ssize_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
 {
     ssize_t retval = -1;
-    char *endptr, c, d;
+    char *endptr;
+    unsigned char c, d;
     int mul_required = 0;
     double val, mul, integral, fraction;