diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c
index c0bfc636962fbb2dc54600e76aed48f062c0dafd..79f05b578fd078b86082911d2aed4b7a3a62c07f 100644
--- a/src/xpdev/genwrap.c
+++ b/src/xpdev/genwrap.c
@@ -48,7 +48,7 @@
 	/* KIOCSOUND */
 	#if defined(__FreeBSD__)
 		#include <sys/kbio.h>
-	#else
+	#elif defined(__linux__)
 		#include <sys/kd.h>	
 	#endif
 #endif	/* __unix__ */
@@ -120,6 +120,7 @@ void DLLCALL unix_beep(int freq, int dur)
 {
 	static int console_fd=-1;
 
+#if !defined(__OpenBSD__)
 	if(console_fd == -1) 
   		console_fd = open("/dev/console", O_NOCTTY);
 	
@@ -128,6 +129,7 @@ void DLLCALL unix_beep(int freq, int dur)
 		SLEEP(dur);
 		ioctl(console_fd, KIOCSOUND, 0);	/* turn off tone */
 	}
+#endif
 }
 #endif