summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-01-11 23:31:43 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-01-11 23:31:43 +0000
commit8dd6df7dd0291f94448bd72803384760ed49c67f (patch)
treeeb41db224398d174e4c5d1a47bcd985f1aa92ec7 /mdk-stage1
parent774e371261e54ced36c80addd09342f2d06344ed (diff)
downloaddrakx-backup-do-not-use-8dd6df7dd0291f94448bd72803384760ed49c67f.tar
drakx-backup-do-not-use-8dd6df7dd0291f94448bd72803384760ed49c67f.tar.gz
drakx-backup-do-not-use-8dd6df7dd0291f94448bd72803384760ed49c67f.tar.bz2
drakx-backup-do-not-use-8dd6df7dd0291f94448bd72803384760ed49c67f.tar.xz
drakx-backup-do-not-use-8dd6df7dd0291f94448bd72803384760ed49c67f.zip
fix failing umount for DISK installs in some failing loopback situations
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/disk.c8
-rw-r--r--mdk-stage1/lomount.c21
2 files changed, 17 insertions, 12 deletions
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c
index ac38f82e0..df2552bd5 100644
--- a/mdk-stage1/disk.c
+++ b/mdk-stage1/disk.c
@@ -108,7 +108,7 @@ static enum return_type try_with_device(char *dev_name)
strcpy(device_fullname, "/dev/");
strcat(device_fullname, choice);
-
+
if (my_mount(device_fullname, disk_own_mount, "ext2") == -1 &&
my_mount(device_fullname, disk_own_mount, "vfat") == -1 &&
my_mount(device_fullname, disk_own_mount, "reiserfs") == -1) {
@@ -140,7 +140,7 @@ static enum return_type try_with_device(char *dev_name)
log_message("%s exists and is not a directory, assuming this is an ISO image", location_full);
if (lomount(location_full, IMAGE_LOCATION)) {
error_message("Could not mount ISO image.");
- umount(IMAGE_LOCATION);
+ umount(disk_own_mount);
return try_with_device(dev_name);
}
} else
@@ -154,11 +154,11 @@ static enum return_type try_with_device(char *dev_name)
"Here's a short extract of the files in the directory:\n"
"%s", list_directory(IMAGE_LOCATION));
umount(disk_own_mount);
- unlink(IMAGE_LOCATION);
return try_with_device(dev_name);
}
if (load_ramdisk() != RETURN_OK) {
error_message("Could not load program into memory.");
+ umount(disk_own_mount);
return try_with_device(dev_name);
}
} else {
@@ -170,7 +170,6 @@ static enum return_type try_with_device(char *dev_name)
"Here's a short extract of the files in the directory:\n"
"%s", list_directory(IMAGE_LOCATION));
umount(disk_own_mount);
- unlink(IMAGE_LOCATION);
return try_with_device(dev_name);
}
if (readlink(IMAGE_LOCATION LIVE_LOCATION "/usr/bin/runinstall2", &p, 1) != 1) {
@@ -178,7 +177,6 @@ static enum return_type try_with_device(char *dev_name)
"You need more memory to perform an installation from a Windows partition. "
"Another solution if to copy the " DISTRIB_NAME " Distribution on a Linux partition.");
umount(disk_own_mount);
- unlink(IMAGE_LOCATION);
return try_with_device(dev_name);
}
log_message("found the " DISTRIB_NAME " Installation, good news!");
diff --git a/mdk-stage1/lomount.c b/mdk-stage1/lomount.c
index ebb107e56..bf152af26 100644
--- a/mdk-stage1/lomount.c
+++ b/mdk-stage1/lomount.c
@@ -70,8 +70,10 @@ set_loop (const char *device, const char *file)
if ((ffd = open (file, mode)) < 0)
return 1;
- if ((fd = open (device, mode)) < 0)
+ if ((fd = open (device, mode)) < 0) {
+ close(ffd);
return 1;
+ }
memset(&loopinfo, 0, sizeof (loopinfo));
strncpy(loopinfo.lo_name, file, LO_NAME_SIZE);
@@ -84,17 +86,22 @@ set_loop (const char *device, const char *file)
* passwd etc being swapped out and left somewhere on disk.
*/
- if(mlockall(MCL_CURRENT|MCL_FUTURE)) {
- log_message("CRITICAL Couldn't lock into memory! %s (memlock)", strerror(errno));
- return 1;
- }
+ if(mlockall(MCL_CURRENT|MCL_FUTURE)) {
+ log_message("CRITICAL Couldn't lock into memory! %s (memlock)", strerror(errno));
+ return 1;
+ }
#endif
- if (ioctl(fd, LOOP_SET_FD, ffd) < 0)
+ if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
+ close(fd);
+ close(ffd);
return 1;
-
+ }
+
if (ioctl(fd, LOOP_SET_STATUS, &loopinfo) < 0) {
(void) ioctl (fd, LOOP_CLR_FD, 0);
+ close(fd);
+ close(ffd);
return 1;
}