summaryrefslogtreecommitdiffstats
path: root/control.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-01-15 14:50:19 +0000
committerRoy Marples <roy@marples.name>2009-01-15 14:50:19 +0000
commitad22dab30ac6653b27b9971100ace375bb067d84 (patch)
tree8cc5e3f123f0094c96fe23c1d73903b004083aeb /control.c
parent5313b78124f566b486748ca071189aba2717d3d4 (diff)
downloaddhcpcd-ad22dab30ac6653b27b9971100ace375bb067d84.tar.xz
We should shutdown instead of close our sockets to inform clients they have gone.
Diffstat (limited to 'control.c')
-rw-r--r--control.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/control.c b/control.c
index 1e614145..e280e3f2 100644
--- a/control.c
+++ b/control.c
@@ -54,7 +54,7 @@ remove_control_data(void *arg)
for (l = fds; l != NULL; l = l->next) {
if (l == arg) {
- close(l->fd);
+ shutdown(l->fd, SHUT_RDWR);
delete_event(l->fd);
if (last == NULL)
fds = l->next;
@@ -152,19 +152,21 @@ stop_control(void)
struct fd_list *l, *ll;
delete_event(fd);
+ if (shutdown(fd, SHUT_RDWR) == -1)
+ retval = 1;
+ fd = -1;
+ if (unlink(CONTROLSOCKET) == -1)
+ retval = -1;
+
l = fds;
while (l != NULL) {
ll = l->next;
delete_event(l->fd);
- close(l->fd);
+ shutdown(l->fd, SHUT_RDWR);
free(l);
l = ll;
}
- if (close(fd) == -1)
- retval = 1;
- fd = -1;
- if (unlink(CONTROLSOCKET) == -1)
- retval = -1;
+
return retval;
}