Skip to contentSkip to conversation

fix PPC compile issues

PATCH In review Chris PeBenito 2 participants 2 messages Feb 5, 2006 – Feb 6, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix PPC compile issues

The attached patch changes variables used to store results of getopt() from char to int, as int is the return of getopt(), and char is unsigned by default on PPC, making tests like if (opt == -1) always false:

cc -Werror -Wall -W -I/usr/include -c -o semodule_link.o
semodule_link.c
semodule_link.c: In function `main':
semodule_link.c:84: warning: comparison is always true due to limited range of data type

 semodule_expand/semodule_expand.c |    4 ++--
 semodule_link/semodule_link.c     |    4 ++--
 sestatus/sestatus.c               |    3 +--
 3 files changed, 5 insertions(+), 6 deletions(-)
Signature · 8 lines
Chris PeBenito
<[email protected]>
Developer,
Hardened Gentoo Linux
Embedded Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243

? policy/policy.20
? policy/policy.conf
? policy/tmp
? policy/file_contexts/file_contexts
? policy/file_contexts/homedir_template
? policy/file_contexts/misc
Index: policycoreutils/semodule_expand/semodule_expand.c
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/semodule_expand/semodule_expand.c,v retrieving revision 1.9

semodule_expand/semodule_expand.c +2 -2
diff -u -r1.9 semodule_expand.c
@@ -36,8 +36,8 @@
 
 int main(int argc, char **argv)
 {
-	char ch, *basename, *outname;
-	int ret, show_version = 0, verbose = 0;
+	char *basename, *outname;
+	int ch, ret, show_version = 0, verbose = 0;
 	struct sepol_policy_file *pf;
 	sepol_module_package_t *base;
 	sepol_policydb_t *out;

Index: policycoreutils/semodule_link/semodule_link.c
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/semodule_link/semodule_link.c,v retrieving revision 1.7

semodule_link/semodule_link.c +2 -2
diff -u -r1.7 semodule_link.c
@@ -73,8 +73,8 @@
 
 int main(int argc, char **argv)
 {
-	int i, show_version = 0, verbose = 0, num_mods;
-	char ch, *basename, *outname = NULL;
+	int ch, i, show_version = 0, verbose = 0, num_mods;
+	char *basename, *outname = NULL;
 	sepol_module_package_t *base, **mods;
 	FILE *outfile;
 	struct sepol_policy_file *pf;

Index: policycoreutils/sestatus/sestatus.c
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/sestatus/sestatus.c,v retrieving revision 1.9

sestatus/sestatus.c +1 -2
diff -u -r1.9 sestatus.c
@@ -160,9 +160,8 @@
 
 int main(int argc, char **argv) {
 	/* these vars are reused several times */
-	int rc, i,c;
+	int rc,opt, i,c;
 	char *context;
-	char opt;
 
 	/* files that need context checks */
 	char *fc[MAX_CHECK];
#1 lore raw
Quoted 11 lines · Chris PeBenito

The attached patch changes variables used to store results of getopt() from char to int, as int is the return of getopt(), and char is unsigned by default on PPC, making tests like if (opt == -1) always false:

cc -Werror -Wall -W -I/usr/include -c -o semodule_link.o
semodule_link.c
semodule_link.c: In function `main':
semodule_link.c:84: warning: comparison is always true due to limited range of data type

Quoted 4 lines
 semodule_expand/semodule_expand.c |    4 ++--
 semodule_link/semodule_link.c     |    4 ++--
 sestatus/sestatus.c               |    3 +--
 3 files changed, 5 insertions(+), 6 deletions(-)

Thanks, merged.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.