summaryrefslogtreecommitdiffstats
path: root/loader/init.c
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>2000-07-31 20:28:26 +0000
committerErik Troan <ewt@redhat.com>2000-07-31 20:28:26 +0000
commit7e441d3694c9e30c23f432bebfefdcd6910f871c (patch)
tree28bc9dbadce2c743c4e5c20b28e81fe17b51900d /loader/init.c
parent1a06624599be925777da976f4b4690d0799d397a (diff)
downloadanaconda-7e441d3694c9e30c23f432bebfefdcd6910f871c.tar.gz
anaconda-7e441d3694c9e30c23f432bebfefdcd6910f871c.tar.xz
anaconda-7e441d3694c9e30c23f432bebfefdcd6910f871c.zip
added eject command to /tmp/cleanup
Diffstat (limited to 'loader/init.c')
-rw-r--r--loader/init.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/loader/init.c b/loader/init.c
index 5c4d5d892..ee2779d11 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -410,7 +410,7 @@ int handleCleanup(void) {
int i;
char buf[4096];
int fd;
- int loopfd;
+ int loopfd, ejectfd;
char * start, * end;
fd = open("/tmp/cleanup", O_RDONLY, 0);
@@ -452,6 +452,20 @@ int handleCleanup(void) {
if (umount(start) < 0)
printf(" failed (%d)", errno);
printf("\n");
+ } else if (!strncmp(start, "eject ", 6)) {
+ start += 6;
+ while (isspace(*start) && start < end) start++;
+ if (start == end) return 1;
+
+ printf("ejecting %s...", start);
+ if ((ejectfd = open(start, O_RDONLY | O_NONBLOCK, 0)) >= 0) {
+ if (ioctl(ejectfd, CDROMEJECT, 0))
+ printf("eject failed %d ", errno);
+
+ close(ejectfd);
+ }
+
+ printf("\n");
}
start = end + 1;