]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
close vnode_fd on detach, too
authorAlan T. DeKok <aland@freeradius.org>
Fri, 24 Nov 2017 16:39:00 +0000 (11:39 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 24 Nov 2017 20:02:55 +0000 (15:02 -0500)
src/modules/proto_detail/proto_detail.h
src/modules/proto_detail/proto_detail_file.c

index 8b0f695f6512da9143442bc5bd1c0510a7746075..2431ce2c27c3b5c4e0afd2ff8d35f9bdc532c396 100644 (file)
@@ -79,6 +79,7 @@ typedef struct proto_detail_work_t {
        char const                      *name;                  //!< debug name for printing
 
        int                             fd;                     //!< file descriptor
+       int                             vnode_fd;               //!< file descriptor for vnode_delete
 
        fr_event_list_t                 *el;                    //!< for various timers
 
index 5f21c55c4dbe10eabf3daca6257881681e2befca..f89443109dbc929bd69ce158c18e3c807ce6198e 100644 (file)
@@ -423,6 +423,8 @@ static int work_exists(proto_detail_file_t *inst, int fd)
                return -1;
        }
 
+       inst->vnode_fd = fd;
+
        return 0;
 }
 
@@ -435,6 +437,7 @@ static void mod_vnode_delete(fr_event_list_t *el, int fd, UNUSED int fflags, voi
 
        (void) fr_event_fd_delete(el, fd, FR_EVENT_FILTER_VNODE);
        close(fd);
+       inst->vnode_fd = -1;
 
        /*
         *      Re-initialize the state machine.
@@ -674,8 +677,13 @@ static int mod_detach(void *instance)
         *      "copy timer from -> to, which means we only have to
         *      delete our child event loop from the parent on close.
         */
-
        close(inst->fd);
+
+       if (inst->vnode_fd >= 0) {
+               (void) fr_event_fd_delete(inst->el, inst->vnode_fd, FR_EVENT_FILTER_VNODE);
+               close(inst->vnode_fd);
+       }
+
        return 0;
 }