]> err.no Git - systemd/commitdiff
libudev: queue - fix get_seqnum_is_finished()
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 23 Apr 2009 11:23:45 +0000 (13:23 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Thu, 23 Apr 2009 11:23:45 +0000 (13:23 +0200)
On Thu, Apr 23, 2009 at 11:39, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
> I'm puzzled by this function:
>
>        /* if we have not seen this seqnum, check if it is/was already queued */
>        if (seqnum < udev_queue->last_seen_udev_seqnum) {
>                udev_queue_get_udev_seqnum(udev_queue);
>                if (seqnum < udev_queue->last_seen_udev_seqnum)
>
> Shouldn't the test be (seqnum > udev_queue->last_seen_udev_seqnum) ?

udev/lib/libudev-queue.c

index a0f4c5575ca4dfccf732711a85850a7676ea0ef4..7550d96370c32254c889165db202f549afb58375 100644 (file)
@@ -179,11 +179,10 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo
        if (udev_queue == NULL)
                return -EINVAL;
        /* if we have not seen this seqnum, check if it is/was already queued */
-       if (seqnum < udev_queue->last_seen_udev_seqnum) {
-               udev_queue_get_udev_seqnum(udev_queue);
-               if (seqnum < udev_queue->last_seen_udev_seqnum)
+       if (seqnum > udev_queue->last_seen_udev_seqnum)
+               if (seqnum > udev_queue_get_udev_seqnum(udev_queue))
                        return 0;
-       }
+
        snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu",
                 udev_get_dev_path(udev_queue->udev), seqnum);
        if (lstat(filename, &statbuf) == 0)