]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/install+setup/install/cdrom.c
f0510e92f72e205b4fcf19c53ef67336e4b25f86
[people/teissler/ipfire-2.x.git] / src / install+setup / install / cdrom.c
1 /* SmoothWall install program.
2 *
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
5 *
6 * (c) Lawrence Manning, 2001
7 * CDROM menu. Get "misc" driver name etc.
8 *
9 * $Id: cdrom.c,v 1.6.2.1 2004/04/14 22:05:39 gespinasse Exp $
10 *
11 */
12
13 #include "install.h"
14
15 extern FILE *flog;
16 extern char *mylog;
17
18 extern char **ctr;
19
20 /* Ejects the CDROM. returns 0 for failure, 1 for success. */
21 int ejectcdrom(char *dev)
22 {
23 int fd;
24
25 if ((fd = open(dev, O_RDONLY|O_NONBLOCK)) == -1)
26 return 0;
27
28 if (ioctl(fd, CDROMEJECT) == -1)
29 {
30 close(fd);
31 return 0;
32 }
33 close(fd);
34
35 return 1;
36 }