summaryrefslogtreecommitdiff
path: root/src/local.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-07-17 13:33:36 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2009-07-17 13:33:36 +0200
commit9406f29b89f6727c3db5485d109466701393b4d4 (patch)
tree6b5b9898b6bd9063d26087450b9044f2e500a80f /src/local.c
parent589fd85fa48b8e1da2debd08b90a6062cf64ef15 (diff)
downloadconntrack-tools-9406f29b89f6727c3db5485d109466701393b4d4.tar.gz
conntrack-tools-9406f29b89f6727c3db5485d109466701393b4d4.zip
local: add LOCAL_RET_* return values for UNIX sockets callbacks
This patch adds the LOCAL_RET_* return values. The return value LOCAL_RET_STOLEN which allows to leave a client socket open while waiting for an operation to finish. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/local.c')
-rw-r--r--src/local.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/local.c b/src/local.c
index 4739e56..feff608 100644
--- a/src/local.c
+++ b/src/local.c
@@ -72,7 +72,7 @@ void local_server_destroy(struct local_server *server)
}
int do_local_server_step(struct local_server *server, void *data,
- void (*process)(int fd, void *data))
+ int (*process)(int fd, void *data))
{
int rfd;
struct sockaddr_un local;
@@ -82,8 +82,9 @@ int do_local_server_step(struct local_server *server, void *data,
if (rfd == -1)
return -1;
- process(rfd, data);
- close(rfd);
+ /* This descriptor will be closed later, we ignore OK and errors */
+ if (process(rfd, data) != LOCAL_RET_STOLEN)
+ close(rfd);
return 0;
}