diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-03-18 17:50:06 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-03-18 17:50:06 +0000 |
commit | 483f665e8a7772bf899f89bbc3cb457d49002890 (patch) | |
tree | 7eb88ce331fd57a2d7c384ed9cf6388c9c775ef6 /mdk-stage1/lomount.c | |
parent | b4a463d96dd6e6792f8cc9ce53178b6647a12eaf (diff) | |
download | drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.tar drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.tar.gz drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.tar.bz2 drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.tar.xz drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.zip |
fix for hd-install when you provide a not valid ISO (cd #2 for example)
Diffstat (limited to 'mdk-stage1/lomount.c')
-rw-r--r-- | mdk-stage1/lomount.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/mdk-stage1/lomount.c b/mdk-stage1/lomount.c index 281de4a93..7d34948b0 100644 --- a/mdk-stage1/lomount.c +++ b/mdk-stage1/lomount.c @@ -110,23 +110,25 @@ set_loop (const char *device, const char *file) return 0; } -int -del_loop (const char *device) + +char * loopdev = "/dev/loop3"; /* Ugly. But do I care? */ + +void +del_loop(void) { int fd; - if ((fd = open (device, O_RDONLY)) < 0) - return 1; + if ((fd = open (loopdev, O_RDONLY)) < 0) + return; if (ioctl (fd, LOOP_CLR_FD, 0) < 0) - return 1; + return; close (fd); - return 0; } -char * loopdev = "/dev/loop3"; /* Ugly. But do I care? */ +static char * where_mounted = NULL; int lomount(char *loopfile, char *where) @@ -145,11 +147,12 @@ lomount(char *loopfile, char *where) } if (my_mount(loopdev, where, "iso9660")) { - del_loop(loopdev); + del_loop(); return 1; } - log_message("lomount succeded for %s on %s", loopfile, where); + where_mounted = strdup(where); + log_message("lomount succeeded for %s on %s", loopfile, where); return 0; } @@ -157,15 +160,11 @@ lomount(char *loopfile, char *where) int loumount() { - if (umount(loopdev)) { - log_perror("loumount"); - return 1; - } - - if (del_loop(loopdev)) { - log_perror("del_loop"); - return 1; + if (where_mounted) { + umount(where_mounted); + where_mounted = NULL; } + del_loop(); return 0; } |