From: Sascha Sommer <[EMAIL PROTECTED]>

Testcase:
$ mount -oloop /etc/group /mnt
ioctl: LOOP_CLR_FD: Device or resource busy
mount: you must specify the filesystem type
$ losetup /dev/loop0
/dev/loop0: [0803]:1931929 (/etc/group)

Signed-off-by: Matthias Koenig <[EMAIL PROTECTED]>
---
 mount/fsprobe_volumeid.c |    5 ++++-
 mount/lomount.c          |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/mount/fsprobe_volumeid.c b/mount/fsprobe_volumeid.c
index 4b58e72..6b47392 100644
--- a/mount/fsprobe_volumeid.c
+++ b/mount/fsprobe_volumeid.c
@@ -34,8 +34,10 @@ static char
                return NULL;
 
        id = volume_id_open_fd(fd);
-       if (!id)
+       if (!id) {
+               close(fd);
                return NULL;
+       }
 
        /* TODO: use blkdev_get_size() */
        if (ioctl(fd, BLKGETSIZE64, &size) != 0)
@@ -61,6 +63,7 @@ static char
        }
 
        volume_id_close(id);
+       close(fd);
        return value;
 }
 
diff --git a/mount/lomount.c b/mount/lomount.c
index ae9eb36..ace474c 100644
--- a/mount/lomount.c
+++ b/mount/lomount.c
@@ -398,6 +398,7 @@ del_loop (const char *device) {
        }
        if (ioctl (fd, LOOP_CLR_FD, 0) < 0) {
                perror ("ioctl: LOOP_CLR_FD");
+               close(fd);
                return 1;
        }
        close (fd);
-- 
1.5.0.4.GIT

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to