src/cdrom/linux/SDL_syscdrom.c
changeset 1051 091350827e08
parent 998 0e6627072f7a
child 1062 3e637850c02b
equal deleted inserted replaced
1050:8e1815fd9777 1051:091350827e08
   130 	}
   130 	}
   131 
   131 
   132 	/* If it does exist, verify that it's an available CD-ROM */
   132 	/* If it does exist, verify that it's an available CD-ROM */
   133 	is_cd = 0;
   133 	is_cd = 0;
   134 	if ( S_ISCHR(stbuf->st_mode) || S_ISBLK(stbuf->st_mode) ) {
   134 	if ( S_ISCHR(stbuf->st_mode) || S_ISBLK(stbuf->st_mode) ) {
   135 		cdfd = open(drive, (O_RDONLY|O_EXCL|O_NONBLOCK), 0);
   135 		cdfd = open(drive, (O_RDONLY|O_NONBLOCK), 0);
   136 		if ( cdfd >= 0 ) {
   136 		if ( cdfd >= 0 ) {
   137 			info.cdsc_format = CDROM_MSF;
   137 			info.cdsc_format = CDROM_MSF;
   138 			/* Under Linux, EIO occurs when a disk is not present.
   138 			/* Under Linux, EIO occurs when a disk is not present.
   139 			 */
   139 			 */
   140 			if ( (ioctl(cdfd, CDROMSUBCHNL, &info) == 0) ||
   140 			if ( (ioctl(cdfd, CDROMSUBCHNL, &info) == 0) ||
   391 	return(SDL_cdlist[drive]);
   391 	return(SDL_cdlist[drive]);
   392 }
   392 }
   393 
   393 
   394 static int SDL_SYS_CDOpen(int drive)
   394 static int SDL_SYS_CDOpen(int drive)
   395 {
   395 {
   396 	return(open(SDL_cdlist[drive], (O_RDONLY|O_EXCL|O_NONBLOCK), 0));
   396 	return(open(SDL_cdlist[drive], (O_RDONLY|O_NONBLOCK), 0));
   397 }
   397 }
   398 
   398 
   399 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom)
   399 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom)
   400 {
   400 {
   401 	struct cdrom_tochdr toc;
   401 	struct cdrom_tochdr toc;