[master 2/3] umountLoopback() now accepts NULL as device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am going to mount /mnt/runtime without a loopback so the parameter will
actually be NULL.
---
 loader/method.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/loader/method.c b/loader/method.c
index d6f83e6..969a47e 100644
--- a/loader/method.c
+++ b/loader/method.c
@@ -62,16 +62,20 @@ extern uint64_t flags;
 int umountLoopback(char * mntpoint, char * device) {
     int loopfd;
 
-    umount(mntpoint);
-
-    logMessage(INFO, "umounting loopback %s %s", mntpoint, device);
-
-    loopfd = open(device, O_RDONLY);
-
-    if (ioctl(loopfd, LOOP_CLR_FD, 0) == -1)
-        logMessage(ERROR, "LOOP_CLR_FD failed for %s %s: %m", mntpoint, device);
+    if (device)
+        logMessage(INFO, "umounting loopback %s (device %s)", mntpoint, device);
+    else
+        logMessage(INFO, "umounting loopback %s", mntpoint);
 
-    close(loopfd);
+    umount(mntpoint);
+    
+    if (device) {
+        /* ak: I think this is unnecessary anyway */
+        loopfd = open(device, O_RDONLY);
+        if (ioctl(loopfd, LOOP_CLR_FD, 0) == -1)
+            logMessage(ERROR, "LOOP_CLR_FD failed for %s %s: %m", mntpoint, device);
+        close(loopfd);
+    }
 
     return 0;
 }
@@ -429,7 +433,6 @@ int mountStage2(char *stage2path) {
     return 0;
 }
 
-
 /* copies a second stage from fd to dest and mounts on mntpoint */
 int copyFileAndLoopbackMount(int fd, char * dest, char * device, char * mntpoint,
                              progressCB pbcb, struct progressCBdata *data,
-- 
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux