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] utils: resolve compiler warnings
Date: Fri, 31 Dec 2010 00:42:15 +0100	[thread overview]
Message-ID: <1293752536-13491-5-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1293752536-13491-1-git-send-email-jengelh@medozas.de>

make  nfulnl_test ulog_test
make[1]: Entering directory `/home/jengelh/code/libnetfilter_log/utils'
  CC     nfulnl_test.o
nfulnl_test.c: In function "cb":
nfulnl_test.c:47:1: warning: no return statement in function returning non-void
nfulnl_test.c: In function "main":
nfulnl_test.c:102:20: warning: unused variable "nlh"
  CCLD   nfulnl_test
  CC     ulog_test.o
ulog_test.c: In function "handle_packet":
ulog_test.c:27:9: warning: format "%d" expects type ‘int’, but argument 4 has type ‘size_t’
ulog_test.c: In function "main":
ulog_test.c:79:3: warning: suggest parentheses around assignment used as truth value
  CCLD   ulog_test
make[1]: Leaving directory `/home/jengelh/code/libnetfilter_log/utils'

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 utils/nfulnl_test.c |    4 ++--
 utils/ulog_test.c   |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/utils/nfulnl_test.c b/utils/nfulnl_test.c
index 139013d..ae5da79 100644
--- a/utils/nfulnl_test.c
+++ b/utils/nfulnl_test.c
@@ -44,6 +44,7 @@ static int cb(struct nflog_g_handle *gh, struct nfgenmsg *nfmsg,
 		struct nflog_data *nfa, void *data)
 {
 	print_pkt(nfa);
+	return 0;
 }
 
 
@@ -99,7 +100,6 @@ int main(int argc, char **argv)
 
 	printf("going into main loop\n");
 	while ((rv = recv(fd, buf, sizeof(buf), 0)) && rv >= 0) {
-		struct nlmsghdr *nlh;
 		printf("pkt received (len=%u)\n", rv);
 
 		/* handle messages in just-received packet */
@@ -121,5 +121,5 @@ int main(int argc, char **argv)
 	printf("closing handle\n");
 	nflog_close(h);
 
-	exit(0);
+	return EXIT_SUCCESS;
 }
diff --git a/utils/ulog_test.c b/utils/ulog_test.c
index d568aa4..f3adec2 100644
--- a/utils/ulog_test.c
+++ b/utils/ulog_test.c
@@ -23,7 +23,7 @@ void handle_packet(ulog_packet_msg_t *pkt)
 	unsigned char *p;
 	int i;
 	
-	printf("Hook=%u Mark=%lu len=%d ",
+	printf("Hook=%u Mark=%lu len=%zu ",
 	       pkt->hook, pkt->mark, pkt->data_len);
 	if (strlen(pkt->prefix))
 		printf("Prefix=%s ", pkt->prefix);
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
 			exit(1);
 		}
 		printf("%d bytes received\n", len);
-		while (upkt = ipulog_get_packet(h, buf, len)) {
+		while ((upkt = ipulog_get_packet(h, buf, len)) != NULL) {
 			handle_packet(upkt);
 		}
 	}
-- 
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:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-30 23:42 libnetfilter_log: build improvements Jan Engelhardt
2010-12-30 23:42 ` [PATCH 1/4] build: remove unused LIBTOOL_DEPS Jan Engelhardt
2010-12-30 23:42 ` [PATCH 2/4] build: create a Make_global.am file Jan Engelhardt
2010-12-30 23:42 ` [PATCH 3/4] build: use -Wall across the entire source Jan Engelhardt
2010-12-30 23:42 ` Jan Engelhardt [this message]
2011-01-06  2:24 ` libnetfilter_log: 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=1293752536-13491-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).