DASH Shell discussions
 help / color / mirror / Atom feed
From: Eric Blake <ebb9@byu.net>
To: dash@vger.kernel.org
Subject: avoid compiler warning
Date: Thu, 09 Jul 2009 06:55:25 -0600	[thread overview]
Message-ID: <4A55E8BD.1090809@byu.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

ccache gcc -DHAVE_CONFIG_H -I. -I..  -include ../config.h -DBSD=1 -DSHELL
-DIFS_BROKEN  -Wall -gdwarf-2 -Wall -Werror -MT mystring.o -MD -MP -MF
.deps/mystring.Tpo -c -o mystring.o mystring.c
miscbltin.c: In function `umaskcmd':
miscbltin.c:201: warning: subscript has type `char'

isdigit is only defined over EOF and unsigned char values, so without this
patch, you can trigger undefined behavior.

Or you can pull from
$ git pull git://repo.or.cz/dash/ericb.git master

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net

[-- Attachment #2: dash.patch1 --]
[-- Type: text/plain, Size: 1005 bytes --]

From 4e9dc98029647880acc1992f36d12331872a818d Mon Sep 17 00:00:00 2001
From: Eric Blake <ebb9@byu.net>
Date: Thu, 9 Jul 2009 06:52:15 -0600
Subject: [PATCH] [BUILD] Avoid compiler warning

Pass correct type to ctype macro.

Signed-off-by: Eric Blake <ebb9@byu.net>
---
 ChangeLog       |    4 ++++
 src/miscbltin.c |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e6a1d26..5731f79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-09  Eric Blake  <ebb9@byu.net>
+
+	* Avoid compiler warnings.
+
 2009-06-27  Herbert Xu <herbert@gondor.apana.org.au>

 	* Fix quoted pattern patch breakage.
diff --git a/src/miscbltin.c b/src/miscbltin.c
index 3f91bc3..65ff46d 100644
--- a/src/miscbltin.c
+++ b/src/miscbltin.c
@@ -198,7 +198,7 @@ umaskcmd(int argc, char **argv)
 	} else {
 		int new_mask;

-		if (isdigit(*ap)) {
+		if (isdigit((unsigned char) *ap)) {
 			new_mask = 0;
 			do {
 				if (*ap >= '8' || *ap < '0')
-- 
1.6.3.3.334.g916e1


             reply	other threads:[~2009-07-09 12:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 12:55 Eric Blake [this message]
2009-08-11  4:03 ` avoid compiler warning Herbert Xu
2009-08-11 16:33   ` H. Peter Anvin
2009-08-11 21:56     ` Herbert Xu
2009-08-11 22:06       ` H. Peter Anvin
2009-08-12  3:19       ` Eric Blake
2009-08-31 11:30       ` Eric Blake
2009-08-31 11:31         ` Herbert Xu
2009-08-12  3:32     ` Eric Blake
2009-08-12  3:30   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A55E8BD.1090809@byu.net \
    --to=ebb9@byu.net \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox