From: <mad...@us...> - 2008-06-13 18:38:36
|
Revision: 2911 http://selinux.svn.sourceforge.net/selinux/?rev=2911&view=rev Author: madmethod Date: 2008-06-13 11:38:34 -0700 (Fri, 13 Jun 2008) Log Message: ----------- Author: Joshua Brindle Email: me...@ma... Subject: libsepol write.c has shadowed var Date: Fri, 13 Jun 2008 13:44:24 -0400 Stephen Smalley wrote: > On Fri, 2008-06-13 at 11:43 -0400, Joshua Brindle wrote: >> This patch addresses a shadowed var that prevents libsepol from being built with DEBUG=1 >> >> Signed-off-by: Joshua Brindle <me...@ma...> >> >> --- >> >> Index: libsepol/src/write.c >> =================================================================== >> --- libsepol/src/write.c (revision 2908) >> +++ libsepol/src/write.c (working copy) >> @@ -1625,10 +1625,10 @@ >> if (p->policyvers < POLICYDB_VERSION_PERMISSIVE && >> p->policy_type == POLICY_KERN) { >> ebitmap_node_t *tnode; >> - unsigned int i; >> + unsigned int j; >> >> - ebitmap_for_each_bit(&p->permissive_map, tnode, i) { >> - if (ebitmap_node_get_bit(tnode, i)) { >> + ebitmap_for_each_bit(&p->permissive_map, tnode, j) { >> + if (ebitmap_node_get_bit(tnode, j)) { >> WARN(fp->handle, "Warning! Policy version %d cannot " >> "support permissive types, but some were defined", >> p->policyvers); > > Any particular reason we can't just use the local var from the outer > scope? > good point, I didn't really look at how i was being used. This uses i from the outer scope and adds -Wshadow to library and checkpolicy makefiles. Acked-by: Stephen Smalley <sd...@ty...> Revision Links: -------------- http://selinux.svn.sourceforge.net/selinux/?rev=2908&view=rev Modified Paths: -------------- trunk/checkpolicy/Makefile trunk/libselinux/src/Makefile trunk/libsemanage/src/Makefile trunk/libsepol/src/Makefile trunk/libsepol/src/write.c Modified: trunk/checkpolicy/Makefile =================================================================== --- trunk/checkpolicy/Makefile 2008-06-13 14:14:57 UTC (rev 2910) +++ trunk/checkpolicy/Makefile 2008-06-13 18:38:34 UTC (rev 2911) @@ -10,7 +10,7 @@ YACC = bison -y -CFLAGS ?= -g -Wall -Werror -O2 -pipe -fno-strict-aliasing +CFLAGS ?= -g -Wall -Werror -Wshadow -O2 -pipe -fno-strict-aliasing override CFLAGS += -I. -I${INCLUDEDIR} Modified: trunk/libselinux/src/Makefile =================================================================== --- trunk/libselinux/src/Makefile 2008-06-13 14:14:57 UTC (rev 2910) +++ trunk/libselinux/src/Makefile 2008-06-13 18:38:34 UTC (rev 2911) @@ -33,7 +33,7 @@ OBJS= $(patsubst %.c,%.o,$(SRCS)) LOBJS= $(patsubst %.c,%.lo,$(SRCS)) -CFLAGS ?= -Werror -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute +CFLAGS ?= -Werror -Wall -W -Wundef -Wshadow -Wmissing-noreturn -Wmissing-format-attribute override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(EMFLAGS) RANLIB=ranlib Modified: trunk/libsemanage/src/Makefile =================================================================== --- trunk/libsemanage/src/Makefile 2008-06-13 14:14:57 UTC (rev 2910) +++ trunk/libsemanage/src/Makefile 2008-06-13 18:38:34 UTC (rev 2911) @@ -31,7 +31,7 @@ LIBSO=$(TARGET).$(LIBVERSION) OBJS= $(patsubst %.c,%.o,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.o conf-parse.o LOBJS= $(patsubst %.c,%.lo,$(filter-out $(SWIGCOUT),$(wildcard *.c))) conf-scan.lo conf-parse.lo -CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter +CFLAGS ?= -Wall -W -Wundef -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter override CFLAGS += -I../include -I$(INCLUDEDIR) -D_GNU_SOURCE Modified: trunk/libsepol/src/Makefile =================================================================== --- trunk/libsepol/src/Makefile 2008-06-13 14:14:57 UTC (rev 2910) +++ trunk/libsepol/src/Makefile 2008-06-13 18:38:34 UTC (rev 2911) @@ -10,7 +10,7 @@ LIBSO=$(TARGET).$(LIBVERSION) OBJS= $(patsubst %.c,%.o,$(wildcard *.c)) LOBJS= $(patsubst %.c,%.lo,$(wildcard *.c)) -CFLAGS ?= -Werror -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute +CFLAGS ?= -Werror -Wall -W -Wundef -Wshadow -Wmissing-noreturn -Wmissing-format-attribute override CFLAGS += -I. -I../include -D_GNU_SOURCE all: $(LIBA) $(LIBSO) Modified: trunk/libsepol/src/write.c =================================================================== --- trunk/libsepol/src/write.c 2008-06-13 14:14:57 UTC (rev 2910) +++ trunk/libsepol/src/write.c 2008-06-13 18:38:34 UTC (rev 2911) @@ -1625,7 +1625,6 @@ if (p->policyvers < POLICYDB_VERSION_PERMISSIVE && p->policy_type == POLICY_KERN) { ebitmap_node_t *tnode; - unsigned int i; ebitmap_for_each_bit(&p->permissive_map, tnode, i) { if (ebitmap_node_get_bit(tnode, i)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |