diff src/cdrom/openbsd/SDL_syscdrom.c @ 1:cf2af46e9e2a

Changes since SDL 1.2.0 release
author Sam Lantinga <slouken@lokigames.com>
date Thu, 26 Apr 2001 16:50:19 +0000
parents 74212992fb08
children 3fbf86244fd2
line wrap: on
line diff
--- a/src/cdrom/openbsd/SDL_syscdrom.c	Thu Apr 26 16:45:43 2001 +0000
+++ b/src/cdrom/openbsd/SDL_syscdrom.c	Thu Apr 26 16:50:19 2001 +0000
@@ -36,6 +36,7 @@
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
+#include <sys/ioctl.h>
 #include <sys/cdio.h>
 
 #include "SDL_error.h"
@@ -64,7 +65,8 @@
 
 /* Some ioctl() errno values which occur when the tray is empty */
 #define ERRNO_TRAYEMPTY(errno)	\
-	((errno == EIO) || (errno == ENOENT) || (errno == EINVAL))
+	((errno == EIO) || (errno == ENOENT) || (errno == EINVAL) || \
+	 (errno == ENODEV))
 
 /* Check a drive to see if it is a CD-ROM */
 static int CheckDrive(char *drive, struct stat *stbuf)
@@ -96,6 +98,8 @@
 			}
 			close(cdfd);
 		}
+		else if (ERRNO_TRAYEMPTY(errno))
+			is_cd = 1;
 	}
 	return(is_cd);
 }
@@ -137,7 +141,11 @@
 int  SDL_SYS_CDInit(void)
 {
 	static char *checklist[] = {
+#ifdef __OpenBSD__
+		"?0 cd?a", "cdrom", NULL
+#else
 		"?0 cd?c", "?0 acd?c", "cdrom", NULL
+#endif
 	};
 	char *SDLcdrom;
 	int i, j, exists;