From 2af820d8449e9dd362bd6c7f68a630361c329290 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Sun, 1 May 2011 11:01:37 +0200 Subject: [PATCH] Fix SIGHUP --- NEWS | 13 +++++++++++++ etc/afpd/afp_dsi.c | 4 ++-- etc/afpd/afp_options.c | 5 ++++- etc/afpd/main.c | 7 +++++-- libatalk/util/socket.c | 11 +++++++++-- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 757b22a7..95049780 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ +Changes in 2.2 +============== + +* UPD: Support for Berkeley DB 5.1 +* UPD: case-conversion is based on Unicode 6.0.0 +* UPD: cnid_metad: allow up to 4096 volumes +* FIX: afpd: configuration reload with SIGHUP +* FIX: afpd: crashes in the dircache +* FIX: afpd: Correct afp logout vs dsi eof behaviour +* FIX: afpd: new catsearch was broken +* FIX: dbd: Multiple fixes, reliable locking +* FIX: ad file suite: fix an error that resulted in CNID database inconsistencies + Changes in 2.2beta4 =================== diff --git a/etc/afpd/afp_dsi.c b/etc/afpd/afp_dsi.c index 0a735ea4..7b10ad0c 100644 --- a/etc/afpd/afp_dsi.c +++ b/etc/afpd/afp_dsi.c @@ -516,8 +516,6 @@ void afp_over_dsi(AFPObj *obj) if (reload_request) { reload_request = 0; load_volumes(AFPobj); - dircache_dump(); - log_dircache_stat(); } /* The first SIGINT enables debugging, the next restores the config */ @@ -525,6 +523,8 @@ void afp_over_dsi(AFPObj *obj) static int debugging = 0; debug_request = 0; + dircache_dump(); + if (debugging) { if (obj->options.logconfig) setuplog(obj->options.logconfig); diff --git a/etc/afpd/afp_options.c b/etc/afpd/afp_options.c index f3724c13..ab33ebee 100644 --- a/etc/afpd/afp_options.c +++ b/etc/afpd/afp_options.c @@ -350,8 +350,11 @@ int afp_options_parseline(char *buf, struct afp_options *options) while (NULL != (c = strstr(c, "-setuplog"))) { char *optstr; if ((optstr = getoption(c, "-setuplog"))) { + /* hokey2: options->logconfig must be converted to store an array of logstrings */ + if (options->logconfig) + free(options->logconfig); + options->logconfig = strdup(optstr); setuplog(optstr); - options->logconfig = optstr; /* at least store the last (possibly only) one */ c += sizeof("-setuplog"); } } diff --git a/etc/afpd/main.c b/etc/afpd/main.c index 0d552d6f..7bee91f2 100644 --- a/etc/afpd/main.c +++ b/etc/afpd/main.c @@ -104,7 +104,6 @@ static void fd_reset_listening_sockets(void) continue; fdset_del_fd(&fdset, &polldata, &fdset_used, &fdset_size, config->fd); } - fd_set_listening_sockets(); } /* ------------------ */ @@ -337,6 +336,7 @@ int main(int ac, char **av) if (reloadconfig) { nologin++; auth_unload(); + fd_reset_listening_sockets(); LOG(log_info, logtype_afpd, "re-reading configuration file"); for (config = configs; config; config = config->next) @@ -350,10 +350,13 @@ int main(int ac, char **av) LOG(log_error, logtype_afpd, "config re-read: no servers configured"); exit(EXITERR_CONF); } - fd_reset_listening_sockets(); + + fd_set_listening_sockets(); + nologin = 0; reloadconfig = 0; errno = saveerrno; + continue; } if (ret == 0) diff --git a/libatalk/util/socket.c b/libatalk/util/socket.c index 528b2646..5bdc03c3 100644 --- a/libatalk/util/socket.c +++ b/libatalk/util/socket.c @@ -486,7 +486,8 @@ void fdset_add_fd(struct pollfd **fdsetp, * Remove a fd from our pollfd array * * 1. Search fd - * 2. If we remove the last array elemnt, just decrease count + * 2a + * 2b If we remove the last array elemnt, just decrease count * 3. If found move all following elements down by one * 4. Decrease count of used elements in array * @@ -507,9 +508,15 @@ void fdset_del_fd(struct pollfd **fdsetp, struct pollfd *fdset = *fdsetp; struct polldata *polldata = *polldatap; + if (*fdset_usedp < 1) + return; + for (int i = 0; i < *fdset_usedp; i++) { if (fdset[i].fd == fd) { /* 1 */ - if (i < (*fdset_usedp - 1)) { /* 2 */ + if (i == 0 && *fdset_usedp == 1) { /* 2a */ + fdset[i].fd = -1; + memset(&polldata[i], 0, sizeof(struct polldata)); + } else if (i < (*fdset_usedp - 1)) { /* 2b */ memmove(&fdset[i], &fdset[i+1], (*fdset_usedp - 1) * sizeof(struct pollfd)); /* 3 */ memmove(&polldata[i], &polldata[i+1], (*fdset_usedp - 1) * sizeof(struct polldata)); /* 3 */ } -- 2.39.2