summaryrefslogtreecommitdiffstats
path: root/src/nfacct.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-04-28 10:57:30 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2014-04-28 10:57:52 +0200
commite8504f0b83a4d0501105259554d9cc23a6672435 (patch)
tree1c3bedb57bf849beae57006a57e2e53d19a129f7 /src/nfacct.c
parentba16753ccb2c72041fb33678ddbafeecde3996e3 (diff)
nfacct: simplify nfacct_cmd_monitor
Simplify the code that was added in ba16753 ("nfacct: adding quota capabilities"). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/nfacct.c')
-rw-r--r--src/nfacct.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nfacct.c b/src/nfacct.c
index 0a078da..e1c405e 100644
--- a/src/nfacct.c
+++ b/src/nfacct.c
@@ -626,7 +626,7 @@ static int nfacct_cmd_monitor(int argc, char *argv[])
struct mnl_socket *nl;
bool xml = false;
char buf[MNL_SOCKET_BUFFER_SIZE];
- int ret, stop = 0, option = NFNLGRP_ACCT_QUOTA;
+ int ret, option = NFNLGRP_ACCT_QUOTA;
nl = mnl_socket_open(NETLINK_NETFILTER);
if (nl == NULL) {
@@ -642,17 +642,16 @@ static int nfacct_cmd_monitor(int argc, char *argv[])
mnl_socket_setsockopt(nl, NETLINK_ADD_MEMBERSHIP,
&option, sizeof(int));
- while (!stop) {
+ while (1) {
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
if (ret == -1) {
- fprintf(stderr, "Problems receiving nfaccounting "
- "notification - bailing out\n");
- stop = 1;
+ perror("mnl_socket_recvfrom");
+ break;
}
ret = mnl_cb_run(buf, ret, 0, 0, nfacct_cb, &xml);
if (ret <= 0)
- stop = 1;
+ break;
}
mnl_socket_close(nl);