[PATCH xtables-addons v2 03/13] pknock: pknlusr: tighten up variable scopes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make global variables local, and move variables local to while-loop into
the loop.

Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx>
---
 extensions/pknock/pknlusr.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/extensions/pknock/pknlusr.c b/extensions/pknock/pknlusr.c
index 4e3e02a0b9f0..808b737f1db2 100644
--- a/extensions/pknock/pknlusr.c
+++ b/extensions/pknock/pknlusr.c
@@ -12,22 +12,16 @@
 
 #define GROUP 1
 
-static struct sockaddr_nl local_addr;
-static int sock_fd;
-
-static unsigned char *buf;
-
-static struct xt_pknock_nl_msg *nlmsg;
-
 int main(void)
 {
 	int status;
 	int group = GROUP;
 
-	int buf_size;
+	struct sockaddr_nl local_addr;
+	int sock_fd;
 
-	const char *ip;
-	char ipbuf[48];
+	int buf_size;
+	unsigned char *buf;
 
 	sock_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
 
@@ -59,6 +53,11 @@ int main(void)
 
 	while(1) {
 
+		struct xt_pknock_nl_msg *nlmsg;
+
+		const char *ip;
+		char ipbuf[48];
+
 		memset(buf, 0, buf_size);
 
 		status = recv(sock_fd, buf, buf_size, 0);
-- 
2.28.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux