Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-updates-src > by-pkgid > 9a9a4f12cd8b4dc8b47eadf5011908a2 > files > 28

util-linux-2.25.2-3.2.mga5.src.rpm

--- util-linux-ng-2.18/mount/lomount.c	2010-09-04 22:16:57.000000000 +0000
+++ util-linux-ng-2.18/mount/lomount.c.tpg	2010-09-04 22:22:02.000000000 +0000
@@ -851,6 +851,10 @@
 	*loopro = (mode == O_RDONLY);
 
 	if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
+	    int saved_errno = errno;
+#define LOOP_CHANGE_FD	0x4C06
+	    if (ioctl (fd, LOOP_CHANGE_FD, ffd) < 0) {
+	    	errno = saved_errno;
 		if(errno == EBUSY)
 			errRetVal = busyRetVal;
 		if((errRetVal != 2) || verbose)
@@ -862,6 +866,10 @@
 close_ffd_return1:
 		close (ffd);
 		return errRetVal;
+ 	    }
+ 	    close (ffd);
+ 	    close (fd);
+ 	    return 0;
 	}
 
 	memset (&loopinfo, 0, sizeof (loopinfo));