diff options
| author | Roy Marples <roy@marples.name> | 2009-01-15 14:50:19 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-01-15 14:50:19 +0000 |
| commit | ad22dab30ac6653b27b9971100ace375bb067d84 (patch) | |
| tree | 8cc5e3f123f0094c96fe23c1d73903b004083aeb /control.c | |
| parent | 5313b78124f566b486748ca071189aba2717d3d4 (diff) | |
| download | dhcpcd-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.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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; } |
