From patchwork Mon Jan 24 15:33:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jes Sorensen X-Patchwork-Id: 80182 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C5883B708B for ; Tue, 25 Jan 2011 02:35:22 +1100 (EST) Received: from localhost ([127.0.0.1]:49547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhORr-0008Sp-4I for incoming@patchwork.ozlabs.org; Mon, 24 Jan 2011 10:35:19 -0500 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 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0OFXZgp010183 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Jan 2011 10:33:35 -0500 Received: from red-feather.redhat.com (ovpn-113-34.phx2.redhat.com [10.3.113.34]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0OFXXXi010003; Mon, 24 Jan 2011 10:33:34 -0500 From: Jes.Sorensen@redhat.com To: kwolf@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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 1/4] strtosz(): use unsigned char and switch to qemu_isspace() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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; } }