From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59449 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhOQE-00082U-QF for qemu-devel@nongnu.org; Mon, 24 Jan 2011 10:33:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhOQD-0001Gl-Ju for qemu-devel@nongnu.org; Mon, 24 Jan 2011 10:33:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhOQD-0001Ge-9A for qemu-devel@nongnu.org; Mon, 24 Jan 2011 10:33:37 -0500 From: Jes.Sorensen@redhat.com Date: Mon, 24 Jan 2011 16:33:28 +0100 Message-Id: <1295883211-18288-2-git-send-email-Jes.Sorensen@redhat.com> In-Reply-To: <1295883211-18288-1-git-send-email-Jes.Sorensen@redhat.com> References: <1295883211-18288-1-git-send-email-Jes.Sorensen@redhat.com> Subject: [Qemu-devel] [PATCH 1/4] strtosz(): use unsigned char and switch to qemu_isspace() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kwolf@redhat.com Cc: qemu-devel@nongnu.org From: Jes Sorensen isspace() behavior is undefined for signed char. Bug pointed out by Eric Blake, thanks! Signed-off-by: Jes Sorensen --- cutils.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cutils.c b/cutils.c index 4d2e27c..a067cf4 100644 --- a/cutils.c +++ b/cutils.c @@ -294,7 +294,8 @@ int fcntl_setfl(int fd, int flag) int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) { int64_t retval = -1; - char *endptr, c, d; + char *endptr; + unsigned char c, d; int mul_required = 0; double val, mul, integral, fraction; @@ -314,7 +315,7 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) */ c = *endptr; d = c; - if (isspace(c) || c == '\0' || c == ',') { + if (qemu_isspace(c) || c == '\0' || c == ',') { c = 0; if (default_suffix) { d = default_suffix; @@ -361,7 +362,7 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) */ if (c != 0) { endptr++; - if (!isspace(*endptr) && *endptr != ',' && *endptr != 0) { + if (!qemu_isspace(*endptr) && *endptr != ',' && *endptr != 0) { goto fail; } } -- 1.7.3.4