summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/init.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c
index 73e82bd7d..5209f1f50 100644
--- a/mdk-stage1/init.c
+++ b/mdk-stage1/init.c
@@ -336,9 +336,26 @@ void unmount_filesystems(void)
fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK, 0);
if (fd > 0) {
ioctl(fd, CDROM_LOCKDOOR, 0);
+ close(fd);
+ }
+ fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK, 0);
+ if (fd > 0) {
+ if (!ioctl(fd, CDROMEJECT, 0))
+ goto ejected;
+ close(fd);
+ }
+ fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK, 0);
+ if (fd > 0) {
+ ioctl(fd, CDROM_LOCKDOOR, 0);
+ close(fd);
+ }
+ fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK, 0);
+ if (fd > 0) {
ioctl(fd, CDROMEJECT, 0);
close(fd);
}
+ ejected:
+ close(fd);
}
#endif