summaryrefslogtreecommitdiff
path: root/src/run.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2011-02-13 21:48:26 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2011-02-13 21:48:26 +0100
commitc6a4bdb9ea086ba48b000777f35090559f86c962 (patch)
tree1e219c29770ce92595d731db693d5c312fe31b6f /src/run.c
parentbbcdcc5fc45606081b41191b32891215f7f134e6 (diff)
downloadconntrack-tools-c6a4bdb9ea086ba48b000777f35090559f86c962.tar.gz
conntrack-tools-c6a4bdb9ea086ba48b000777f35090559f86c962.zip
local: don't override initial return value
The return initial value is overriden after the initial read. Don't override this value, instead we check the return value of the read() operation. This patch also changes the error statistics accounting since we consider that a request with no data is an error. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/run.c')
-rw-r--r--src/run.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/run.c b/src/run.c
index 5781939..d96ff6c 100644
--- a/src/run.c
+++ b/src/run.c
@@ -191,14 +191,10 @@ static int local_handler(int fd, void *data)
int ret = LOCAL_RET_OK;
int type;
- ret = read(fd, &type, sizeof(type));
- if (ret == -1) {
+ if (read(fd, &type, sizeof(type)) <= 0) {
STATE(stats).local_read_failed++;
return LOCAL_RET_OK;
}
- if (ret == 0)
- return LOCAL_RET_OK;
-
switch(type) {
case FLUSH_MASTER:
STATE(stats).nl_kernel_table_flush++;