From b87a0f41b1d394c9972ceda81092ac8a1e60cde9 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 9 Sep 2001 17:33:59 +0000 Subject: (ejectCdrom): fix D state on exit --- perl-install/install_any.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 56f469594..55500ba91 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -479,10 +479,13 @@ sub unlockCdrom(;$) { sub ejectCdrom(;$) { my ($cdrom) = @_; getFile("XXX"); #- close still opened filehandle - $cdrom or cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image), and $cdrom = $1; - my $f = eval { $cdrom && detect_devices::tryOpen($cdrom) } or return; - eval { fs::umount("/tmp/image") }; - ioctl $f, c::CDROMEJECT(), 1; + $cdrom ||= $1 if cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image),; + if ($cdrom) { + #- umount BEFORE opening the cdrom device otherwise the umount will + #- D state if the cdrom is already removed + eval { fs::umount("/tmp/image") }; + eval { ioctl detect_devices::tryOpen($cdrom), c::CDROMEJECT(), 1 }; + } } sub setupFB { -- cgit v1.2.1