diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-08-09 03:16:37 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-08-09 03:16:37 +0000 |
commit | 30d35b93fac7a906ac70fa825f6f640353ed41d6 (patch) | |
tree | 46d35f64c26be5ba43c9dd40b1f8a56ed96538a0 /perl-install | |
parent | b42262b1e1a30bfd7f09210e1d3b6f0da8ca6734 (diff) | |
download | drakx-backup-do-not-use-30d35b93fac7a906ac70fa825f6f640353ed41d6.tar drakx-backup-do-not-use-30d35b93fac7a906ac70fa825f6f640353ed41d6.tar.gz drakx-backup-do-not-use-30d35b93fac7a906ac70fa825f6f640353ed41d6.tar.bz2 drakx-backup-do-not-use-30d35b93fac7a906ac70fa825f6f640353ed41d6.tar.xz drakx-backup-do-not-use-30d35b93fac7a906ac70fa825f6f640353ed41d6.zip |
- fix unlockCdrom()
- ejectCdrom() prototype compliance with perl_checker
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/install_any.pm | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index e1fd4a458..2bd17d7a3 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -603,25 +603,23 @@ sub killCardServices() { $pid and kill(15, $pid); #- send SIGTERM } -sub unlockCdrom(;$) { - my ($cdrom) = @_; - $cdrom or cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image), and $cdrom = $1; - eval { $cdrom and ioctl detect_devices::tryOpen($1), c::CDROM_LOCKDOOR(), 0 }; +sub unlockCdrom() { + my $cdrom = cat_("/proc/mounts") =~ m!(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image)! && $1 or return; + eval { ioctl(detect_devices::tryOpen($cdrom), c::CDROM_LOCKDOOR(), 0) }; } -sub ejectCdrom(;$) { - my ($cdrom) = @_; +sub ejectCdrom { + my ($o_cdrom) = @_; getFile("XXX"); #- close still opened filehandle - $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") }; - $@ and warnAboutFilesStillOpen(); - eval { - my $dev = detect_devices::tryOpen($cdrom); - ioctl($dev, c::CDROMEJECT(), 1) if ioctl($dev, c::CDROM_DRIVE_STATUS(), 0) == c::CDS_DISC_OK(); - }; - } + my $cdrom = $o_cdrom || cat_("/proc/mounts") =~ m!(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image)! && $1 or return; + + #- umount BEFORE opening the cdrom device otherwise the umount will + #- D state if the cdrom is already removed + eval { fs::umount("/tmp/image") }; + $@ and warnAboutFilesStillOpen(); + eval { + my $dev = detect_devices::tryOpen($o_cdrom); + ioctl($dev, c::CDROMEJECT(), 1) if ioctl($dev, c::CDROM_DRIVE_STATUS(), 0) == c::CDS_DISC_OK(); + }; } sub warnAboutFilesStillOpen() { |