inode_put_fd(): Fix incorrect assertion
authorEric Biggers <ebiggers3@gmail.com>
Mon, 12 Nov 2012 00:10:44 +0000 (18:10 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 12 Nov 2012 00:11:07 +0000 (18:11 -0600)
src/mount.c

index ed428fca58907d1b943fb51b7590cbd934c92ace..b9da36e172f5f1e5e11702a56325db4f57941409 100644 (file)
@@ -185,7 +185,7 @@ static int alloc_wimlib_fd(struct inode *inode,
                        inode->num_opened_fds++;
                        if (lte)
                                lte->num_opened_fds++;
-                       DEBUG("Allocated fd");
+                       DEBUG("Allocated fd (idx = %u)", fd->idx);
                        return 0;
                }
        }
@@ -193,11 +193,11 @@ static int alloc_wimlib_fd(struct inode *inode,
 
 static void inode_put_fd(struct inode *inode, struct wimlib_fd *fd)
 {
-       wimlib_assert(fd);
-       wimlib_assert(inode);
+       wimlib_assert(fd != NULL);
+       wimlib_assert(inode != NULL);
        wimlib_assert(fd->f_inode == inode);
-       wimlib_assert(inode->num_opened_fds);
-       wimlib_assert(fd->idx < inode->num_opened_fds);
+       wimlib_assert(inode->num_opened_fds != 0);
+       wimlib_assert(fd->idx < inode->num_allocated_fds);
        wimlib_assert(inode->fds[fd->idx] == fd);
 
        inode->fds[fd->idx] = NULL;