netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@medozas.de>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 4/4] qa: resolve compiler warnings
Date: Fri, 31 Dec 2010 00:41:42 +0100	[thread overview]
Message-ID: <1293752503-13178-5-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1293752503-13178-1-git-send-email-jengelh@medozas.de>

-Wall flags this:

make  test_api test_filter
make[1]: Entering directory `/home/jengelh/code/libnetfilter_conntrack/qa'
  CC     test_api.o
test_api.c:16:8: warning: return type defaults to "int"
test_api.c: In function "eval_sigterm":
test_api.c:23:18: warning: too many arguments for format
test_api.c: In function "main":
test_api.c:55:2: warning: implicit declaration of function "fork"
test_api.c:34:22: warning: unused variable "h"
test_api.c:102:1: warning: control reaches end of non-void function
test_api.c: In function "eval_sigterm":
test_api.c:29:1: warning: control reaches end of non-void function
  CCLD   test_api
  CC     test_filter.o
test_filter.c: In function "main":
test_filter.c:58:4: warning: implicit declaration of function "inet_addr"
test_filter.c:74:2: warning: implicit declaration of function "strerror"
test_filter.c:74:2: warning: format "%s" expects type ‘char *’, but argument 3 has type ‘int’
test_filter.c:75:1: warning: control reaches end of non-void function
  CCLD   test_filter

make[1]: Leaving directory `/home/jengelh/code/libnetfilter_conntrack/qa'

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 qa/test_api.c    |    9 +++++----
 qa/test_filter.c |    6 +++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/qa/test_api.c b/qa/test_api.c
index eda9d49..e7a8453 100644
--- a/qa/test_api.c
+++ b/qa/test_api.c
@@ -4,6 +4,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <sys/wait.h>
 #include <errno.h>
 
@@ -13,14 +14,14 @@
  * this file contains a test to check the set/get/copy/cmp APIs.
  */
 
-static eval_sigterm(int status)
+static void eval_sigterm(int status)
 {
 	switch(WTERMSIG(status)) {
 	case SIGSEGV:
 		printf("received SIGSEV\n");
 		break;
 	case 0:
-		printf("OK\n", WTERMSIG(status));
+		printf("OK\n");
 		break;
 	default:
 		printf("exited with signal: %d\n", WTERMSIG(status));
@@ -28,10 +29,9 @@ static eval_sigterm(int status)
 	}
 }
 
-int main()
+int main(void)
 {
 	int ret, i;
-	struct nfct_handle *h;
 	struct nf_conntrack *ct, *tmp;
 	char data[32];
 	int status;
@@ -99,4 +99,5 @@ int main()
 
 	nfct_destroy(ct);
 	nfct_destroy(tmp);
+	return EXIT_SUCCESS;
 }
diff --git a/qa/test_filter.c b/qa/test_filter.c
index 35fdbec..7877819 100644
--- a/qa/test_filter.c
+++ b/qa/test_filter.c
@@ -3,6 +3,9 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <arpa/inet.h>
 #include <errno.h>
 
 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
@@ -23,7 +26,7 @@ static int event_cb(enum nf_conntrack_msg_type type,
 	return NFCT_CB_CONTINUE;
 }
 
-int main()
+int main(void)
 {
 	int i, ret;
 	struct nfct_handle *h;
@@ -72,4 +75,5 @@ int main()
 
 	ret = nfct_catch(h);
 	printf("test ret=%d (%s)\n", ret, strerror(errno));
+	return EXIT_SUCCESS;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-12-30 23:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-30 23:41 libnetfilter_conntrack: build improvements Jan Engelhardt
2010-12-30 23:41 ` [PATCH 1/4] build: remove unused LIBTOOL_DEPS Jan Engelhardt
2010-12-30 23:41 ` [PATCH 2/4] build: use -Wall across the entire source Jan Engelhardt
2010-12-30 23:41 ` [PATCH 3/4] utils: resolve compiler warnings Jan Engelhardt
2010-12-30 23:41 ` Jan Engelhardt [this message]
2011-01-06  2:26 ` libnetfilter_conntrack: build improvements Pablo Neira Ayuso

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=1293752503-13178-5-git-send-email-jengelh@medozas.de \
    --to=jengelh@medozas.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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;
as well as URLs for NNTP newsgroup(s).