kadischi/eject_live_cd eject_live_cd.c,1.3,1.4
Jasper O'neal Hartline (autopsy)
fedora-extras-commits at redhat.com
Sat Jul 29 07:38:00 UTC 2006
Author: autopsy
Update of /cvs/devel/kadischi/eject_live_cd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv18964/kadischi/eject_live_cd
Modified Files:
eject_live_cd.c
Log Message:
Clean up eject_live_cd.c, eject the CD device cleaner
Index: eject_live_cd.c
===================================================================
RCS file: /cvs/devel/kadischi/eject_live_cd/eject_live_cd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- eject_live_cd.c 12 Jul 2006 01:25:07 -0000 1.3
+++ eject_live_cd.c 29 Jul 2006 07:37:58 -0000 1.4
@@ -460,35 +460,30 @@
return 0;
}
+/* Opens the CD DEVICE */
-static int EjectCdrom(int fd)
+static int EjectCdrom()
{
int status;
int cdrom;
+ int fd = open(CDDEVICE, O_RDONLY|O_NONBLOCK);
+ int lock;
+ int unlock;
+ if (fd == -1) {
+ exit(1);
+ }
+ if (unlock = ioctl(fd, CDROM_LOCKDOOR, 0) == 0) {
if (status = ioctl(fd, CDROMEJECT)<0) {
perror("ioctl");
}
+ }
close(fd);
return (status == 0);
}
-
-
-static int OpenDevice()
-{
- int fd = open(CDDEVICE, O_RDONLY|O_NONBLOCK);
- if (fd == -1) {
- exit(1);
- }
- return fd;
-}
-
-
-
-
int main(int argc, char **argv)
{
@@ -500,7 +495,7 @@
if (livecd = setupCdrom(location)) {
umount(location);
- worked = EjectCdrom(fd);
+ worked = EjectCdrom();
}
}
More information about the fedora-extras-commits
mailing list