From aa94fc1d08bd0dc8245dae9484642c3ceba7f086 Mon Sep 17 00:00:00 2001 From: Steve Beattie Date: Tue, 21 Aug 2007 17:28:34 +0000 Subject: [PATCH] - Add configure check for the existence of asprint(3). - Add -Wall to compilation (is there a way to only define this in the toplevel Makefile.am and have it propogate down?) - fix warnings once -Wall was enabled: - no asprintf prototype due to _GNU_SOURCE not being defined - possible uninitialezed use in scanner.l - printf's that expected ints but were passed longs in the testsuite --- changehat/libapparmor/configure.in | 3 ++- changehat/libapparmor/src/Makefile.am | 6 ++++-- changehat/libapparmor/src/aalogparse.h | 2 +- changehat/libapparmor/src/change_hat.c | 2 -- changehat/libapparmor/src/scanner.l | 2 +- changehat/libapparmor/testsuite/Makefile.am | 3 ++- changehat/libapparmor/testsuite/test_multi.c | 6 +++--- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/changehat/libapparmor/configure.in b/changehat/libapparmor/configure.in index 9563c32b8..40b514401 100644 --- a/changehat/libapparmor/configure.in +++ b/changehat/libapparmor/configure.in @@ -6,7 +6,6 @@ AM_PROG_LEX AC_PROG_YACC AC_PATH_PROG([SWIG], [swig]) - PROG_POD2MAN @@ -57,6 +56,8 @@ AM_CONDITIONAL(BUILD_ROOTLIB, test x$enable_rootlib = xyes) AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h stdint.h) +AC_CHECK_FUNCS(asprintf) + AM_PROG_CC_C_O AC_C_CONST AM_PROG_LIBTOOL diff --git a/changehat/libapparmor/src/Makefile.am b/changehat/libapparmor/src/Makefile.am index 330686407..9647526fa 100644 --- a/changehat/libapparmor/src/Makefile.am +++ b/changehat/libapparmor/src/Makefile.am @@ -2,10 +2,12 @@ INCLUDES = $(all_includes) BUILT_SOURCES = grammar.h scanner.h AM_YFLAGS = -d -p aalogparse_ - -scanner.h: +AM_CFLAGS = @CFLAGS@ -D_GNU_SOURCE -Wall +scanner.h: scanner.l $(LEX) scanner.l +scanner.c: scanner.l + changehatdir = $(includedir)/sys changehat_HEADERS = apparmor.h diff --git a/changehat/libapparmor/src/aalogparse.h b/changehat/libapparmor/src/aalogparse.h index d5ea01ab0..3a4a46675 100644 --- a/changehat/libapparmor/src/aalogparse.h +++ b/changehat/libapparmor/src/aalogparse.h @@ -117,7 +117,7 @@ typedef struct aa_record_event_type event; /* Event type */ long pid; /* PID of the program logging the message */ long task; - long magic_token; + unsigned long magic_token; long epoch; /* example: 12345679 */ unsigned int audit_sub_id; /* example: 12 */ diff --git a/changehat/libapparmor/src/change_hat.c b/changehat/libapparmor/src/change_hat.c index b50cd71e3..4546187d6 100644 --- a/changehat/libapparmor/src/change_hat.c +++ b/changehat/libapparmor/src/change_hat.c @@ -8,8 +8,6 @@ */ -#define _GNU_SOURCE /* for asprintf */ - #include #include #include diff --git a/changehat/libapparmor/src/scanner.l b/changehat/libapparmor/src/scanner.l index 9b27d9ddd..199235c92 100644 --- a/changehat/libapparmor/src/scanner.l +++ b/changehat/libapparmor/src/scanner.l @@ -102,7 +102,7 @@ audit "audit" %% %{ char string_buf[512]; -char *string_buf_ptr; +char *string_buf_ptr = string_buf; /* assignment to quiet gcc warning */ /* yy_flex_debug = 1; */ %} diff --git a/changehat/libapparmor/testsuite/Makefile.am b/changehat/libapparmor/testsuite/Makefile.am index d06c94277..cec81541c 100644 --- a/changehat/libapparmor/testsuite/Makefile.am +++ b/changehat/libapparmor/testsuite/Makefile.am @@ -5,11 +5,12 @@ AUTOMAKE_OPTIONS = dejagnu INCLUDES = -I. -I$(top_srcdir)/src AM_CPPFLAGS = $(DEBUG_FLAGS) -DLOCALEDIR=\"${localedir}\" +AM_CFLAGS = -Wall noinst_PROGRAMS = test_multi.multi test_multi_multi_SOURCES = test_multi.c -test_multi_multi_CFLAGS = $(CFLAGS) +test_multi_multi_CFLAGS = $(CFLAGS) -Wall test_multi_multi_LDFLAGS = $(LDFLAGS) ../src/.libs/libapparmor.a clean-local: diff --git a/changehat/libapparmor/testsuite/test_multi.c b/changehat/libapparmor/testsuite/test_multi.c index 86cbeb3d7..0b85a146b 100644 --- a/changehat/libapparmor/testsuite/test_multi.c +++ b/changehat/libapparmor/testsuite/test_multi.c @@ -131,7 +131,7 @@ int print_results(aa_log_record *record) } if (record->task != 0) { - printf("Task: %i\n", record->task); + printf("Task: %ld\n", record->task); } if (record->parent != NULL) { @@ -139,7 +139,7 @@ int print_results(aa_log_record *record) } if (record->magic_token != 0) { - printf("Token: %i\n", record->magic_token); + printf("Token: %lu\n", record->magic_token); } if (record->info != NULL) { @@ -147,7 +147,7 @@ int print_results(aa_log_record *record) } if (record->pid != 0) { - printf("PID: %i\n", record->pid); + printf("PID: %ld\n", record->pid); } if (record->active_hat != NULL) {