diff options
| author | Karel Zak <kzak@redhat.com> | 2012-01-16 11:28:05 +0100 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2012-01-16 11:28:05 +0100 |
| commit | 8b470b20d70eaf2daa84975af13130433c79d1f8 (patch) | |
| tree | 10285844267726d04ad82d89a39c675d2b42e102 /lib/loopdev.c | |
| parent | ce43340461db49e0b6cbd9d3cbdbf38b6d85f220 (diff) | |
| download | util-linux-8b470b20d70eaf2daa84975af13130433c79d1f8.tar.gz | |
libmount: avoid duplicate loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/loopdev.c')
| -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 2035d23143..0e22bca1cc 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) |
