From f7e21185087c30c5f13bf92009238e316f8c1cf4 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Tue, 27 May 2014 20:38:10 +0200 Subject: losetup: don't clear FD at EBUSY error in loopcxt_setup_device() loopback lib clears the existing FD unconditionally at error in loopcxt_setup_device(). This is done even after EBUSY, thus the second call actually clears the previous setup wrongly. Author: Takashi Iwai Signed-off-by: Stanislav Brabec --- lib/loopdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/loopdev.c') diff --git a/lib/loopdev.c b/lib/loopdev.c index 1fbb000c4..988f3d337 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -1294,7 +1294,7 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) err: if (file_fd >= 0) close(file_fd); - if (dev_fd >= 0) + if (dev_fd >= 0 && rc != -EBUSY) ioctl(dev_fd, LOOP_CLR_FD, 0); DBG(lc, loopdev_debug("setup failed [rc=%d]", rc)); -- cgit v1.2.3-55-g7522