comparison src/cdrom/linux/SDL_syscdrom.c @ 1051:091350827e08

SDL_CDOpen() fails on Linux if data track on disc is mounted in the filesystem. Removing O_EXCL from open() call fixes this. Problem and solution noted by "Fosters": http://www.libsdl.org/pipermail/sdl/2005-March/068028.html
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 17 Apr 2005 10:36:03 +0000
parents 0e6627072f7a
children 3e637850c02b
comparison
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;