Well, but why to put this in umountLoopback at all? Don't we have separate umount call? And if this is here because we call this to umount stage2 and we need to decide how we mounted it, then the decision logic should be in the caller function and not here. Martin ----- "Ales Kozumplik" <akozumpl@xxxxxxxxxx> wrote: > 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 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list