DASH Shell discussions
 help / color / mirror / Atom feed
* avoid compiler warning
@ 2009-07-09 12:55 Eric Blake
  2009-08-11  4:03 ` Herbert Xu
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Blake @ 2009-07-09 12:55 UTC (permalink / raw)
  To: dash

[-- 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-08-31 11:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-09 12:55 avoid compiler warning Eric Blake
2009-08-11  4:03 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox