From 8b470b20d70eaf2daa84975af13130433c79d1f8 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 16 Jan 2012 11:28:05 +0100 Subject: libmount: avoid duplicate loopdevs Signed-off-by: Karel Zak --- lib/loopdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/loopdev.c') 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) -- cgit v1.2.3-55-g7522