]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: (monitor) require entry-specific functions
authorKarel Zak <kzak@redhat.com>
Tue, 27 May 2025 11:23:39 +0000 (13:23 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Aug 2025 12:50:56 +0000 (14:50 +0200)
libmount/src/monitor.c

index 3890b18c2ab0678cc959752720cf81ce4377658f..66319132681eff86e5daeff14ac1c63f7d775552 100644 (file)
@@ -189,8 +189,12 @@ int monitor_modify_epoll(struct libmnt_monitor *mn,
 
        if (enable) {
                struct epoll_event ev = { .events = me->events };
-               int fd = me->opers->op_get_fd(mn, me);
+               int fd;
 
+               assert(me->opers->op_get_fd);
+               assert(me->opers->op_process_event);
+
+               fd = me->opers->op_get_fd(mn, me);
                if (fd < 0)
                        goto err;
 
@@ -347,8 +351,7 @@ int mnt_monitor_wait(struct libmnt_monitor *mn, int timeout)
                if (!me)
                        return -EINVAL;
 
-               if (me->opers->op_process_event == NULL ||
-                   me->opers->op_process_event(mn, me) == 1) {
+               if (me->opers->op_process_event(mn, me) == 1) {
                        me->active = 1;
                        break;
                }
@@ -418,8 +421,7 @@ int mnt_monitor_next_change(struct libmnt_monitor *mn,
                if (!me)
                        return -EINVAL;
 
-               if (me->opers->op_process_event != NULL &&
-                   me->opers->op_process_event(mn, me) != 1)
+               if (me->opers->op_process_event(mn, me) != 1)
                        me = NULL;
        }