diff options
author | Karel Zak | 2012-01-16 11:28:05 +0100 |
---|---|---|
committer | Karel Zak | 2012-01-16 11:28:05 +0100 |
commit | 8b470b20d70eaf2daa84975af13130433c79d1f8 (patch) | |
tree | 10285844267726d04ad82d89a39c675d2b42e102 /lib | |
parent | mount: (new) print error messages (diff) | |
download | kernel-qcow2-util-linux-8b470b20d70eaf2daa84975af13130433c79d1f8.tar.gz kernel-qcow2-util-linux-8b470b20d70eaf2daa84975af13130433c79d1f8.tar.xz kernel-qcow2-util-linux-8b470b20d70eaf2daa84975af13130433c79d1f8.zip |
libmount: avoid duplicate loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/loopdev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/loopdev.c b/lib/loopdev.c index 2035d2314..0e22bca1c 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -1225,7 +1225,7 @@ int loopdev_is_used(const char *device, const char *filename, struct stat st; int rc = 0; - if (!device) + if (!device || !filename) return 0; loopcxt_init(&lc, 0); @@ -1243,6 +1243,9 @@ int loopdev_delete(const char *device) struct loopdev_cxt lc; int rc; + if (!device) + return -EINVAL; + loopcxt_init(&lc, 0); rc = loopcxt_set_device(&lc, device); if (!rc) |