This code is mostly just confusing. Close the fds immediately instead of doing so later. Signed-off-by: David Härdeman <david@xxxxxxxxxxx> --- utils/gssd/gssd.c | 26 ++++++++------------------ utils/gssd/gssd.h | 2 -- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c index 632d1a1..2187562 100644 --- a/utils/gssd/gssd.c +++ b/utils/gssd/gssd.c @@ -366,7 +366,10 @@ gssd_clnt_gssd_cb(int UNUSED(fd), short which, void *data) struct clnt_info *clp = data; if (which != EV_READ) { - clp->gssd_close_me = true; + printerr(2, "Closing 'gssd' pipe for %s\n", clp->dirname); + close(clp->gssd_fd); + clp->gssd_fd = -1; + event_del(&clp->gssd_ev); gssd_update_clients(); return; } @@ -380,7 +383,10 @@ gssd_clnt_krb5_cb(int UNUSED(fd), short which, void *data) struct clnt_info *clp = data; if (which != EV_READ) { - clp->krb5_close_me = true; + printerr(2, "Closing 'krb5' pipe for %s\n", clp->dirname); + close(clp->krb5_fd); + clp->krb5_fd = -1; + event_del(&clp->krb5_ev); gssd_update_clients(); return; } @@ -396,22 +402,6 @@ process_clnt_dir_files(struct clnt_info * clp) bool gssd_was_closed; bool krb5_was_closed; - if (clp->gssd_close_me) { - printerr(2, "Closing 'gssd' pipe for %s\n", clp->dirname); - close(clp->gssd_fd); - event_del(&clp->gssd_ev); - clp->gssd_fd = -1; - clp->gssd_close_me = false; - } - - if (clp->krb5_close_me) { - printerr(2, "Closing 'krb5' pipe for %s\n", clp->dirname); - close(clp->krb5_fd); - event_del(&clp->krb5_ev); - clp->krb5_fd = -1; - clp->krb5_close_me = false; - } - gssd_was_closed = clp->gssd_fd < 0 ? true : false; krb5_was_closed = clp->krb5_fd < 0 ? true : false; diff --git a/utils/gssd/gssd.h b/utils/gssd/gssd.h index 2417579..cea2b92 100644 --- a/utils/gssd/gssd.h +++ b/utils/gssd/gssd.h @@ -74,10 +74,8 @@ struct clnt_info { char *protocol; int krb5_fd; struct event krb5_ev; - bool krb5_close_me; int gssd_fd; struct event gssd_ev; - bool gssd_close_me; struct sockaddr_storage addr; }; -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html