summaryrefslogtreecommitdiffstats
path: root/loader/loader.c
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2001-06-22 16:23:59 +0000
committerJeremy Katz <katzj@redhat.com>2001-06-22 16:23:59 +0000
commit47770d7221df701d951372b3235706b45e345e67 (patch)
tree5c51c553bda22ebfee8b2250990e002587f15820 /loader/loader.c
parentff1db941bc5409f074b267a7f9928d184ea0edbd (diff)
downloadanaconda-47770d7221df701d951372b3235706b45e345e67.tar.gz
anaconda-47770d7221df701d951372b3235706b45e345e67.tar.xz
anaconda-47770d7221df701d951372b3235706b45e345e67.zip
don't use the same loop device more than once; use different file names for different loopbacks
Diffstat (limited to 'loader/loader.c')
-rw-r--r--loader/loader.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/loader/loader.c b/loader/loader.c
index 19bb7f34c..7eac30575 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -518,10 +518,10 @@ static char * setupIsoImages(char * device, char * type, char * dirName,
continue;
}
- rc = loadLocalImages("/tmp/loopimage", "/", flags, "loop0",
+ rc = loadLocalImages("/tmp/loopimage", "/", flags, "loop1",
"/mnt/runtime");
if (!rc) {
- umountLoopback("/tmp/loopimage", "loop0");
+ umountLoopback("/tmp/loopimage", "loop1");
break;
}
@@ -592,13 +592,21 @@ static int umountLoopback(char * mntpoint, char * device) {
static int mountLoopback(char * fsystem, char * mntpoint, char * device) {
struct loop_info loopInfo;
int targfd, loopfd;
+ char *filename;
+
+ mkdirChain(mntpoint);
+ filename = alloca(15 + strlen(device));
+ sprintf(filename, "/tmp/%s", device);
+
+ devMakeInode(device, filename);
+ loopfd = open(filename, O_RDONLY);
mkdirChain(mntpoint);
targfd = open(fsystem, O_RDONLY);
- devMakeInode(device, "/tmp/loop");
- loopfd = open("/tmp/loop", O_RDONLY);
+ devMakeInode(device, filename);
+ loopfd = open(filename, O_RDONLY);
logMessage("loopfd is %d", loopfd);
if (ioctl(loopfd, LOOP_SET_FD, targfd)) {
@@ -621,11 +629,11 @@ static int mountLoopback(char * fsystem, char * mntpoint, char * device) {
close(loopfd);
- if (doPwMount("/tmp/loop", mntpoint, "iso9660", 1,
+ if (doPwMount(filename, mntpoint, "iso9660", 1,
0, NULL, NULL)) {
- if (doPwMount("/tmp/loop", mntpoint, "ext2", 1,
+ if (doPwMount(filename, mntpoint, "ext2", 1,
0, NULL, NULL)) {
- if (doPwMount("/tmp/loop", mntpoint, "cramfs", 1,
+ if (doPwMount(filename, mntpoint, "cramfs", 1,
0, NULL, NULL)) {
logMessage("failed to mount loop: %s",