[Freemint-list] [PATCH] lseek on devices

Vincent Rivière vincent.riviere at freesbee.fr
Sun Oct 16 20:35:11 MSD 2016


Hello.

I noticed that mikmod refused to redirect its standard output to /dev/audio 
because it was a terminal. Of course this is wrong. The cause was isatty() 
returning true for /dev/audio.

The attached kernel patch returns ESPIPE in lseek for devices, which is the 
right thing to do. On the other hand, it seems that terminals must always 
return 0 on lseek, I didn't change that. So the affected devices are only 
audiodev and dsp56k.

lseek.patch
Return ESPIPE for non-seekable devices. Contributed by Vincent Riviere.

Alan, please commit!

-- 
Vincent Rivière
-------------- next part --------------
diff -aurN -x CVS freemint.orig/sys/xdd/audio/audiodev.c freemint/sys/xdd/audio/audiodev.c
--- freemint.orig/sys/xdd/audio/audiodev.c	2007-07-13 23:32:53.000000000 +0200
+++ freemint/sys/xdd/audio/audiodev.c	2016-10-16 17:17:59.011041400 +0200
@@ -233,7 +233,7 @@
 static long
 audio_lseek (FILEPTR *fp, long where, int whence)
 {
-	return 0;
+	return ESPIPE;
 }
 
 static long
diff -aurN -x CVS freemint.orig/sys/xdd/dsp56k/dsp56k.c freemint/sys/xdd/dsp56k/dsp56k.c
--- freemint.orig/sys/xdd/dsp56k/dsp56k.c	2013-05-15 21:16:43.796875000 +0200
+++ freemint/sys/xdd/dsp56k/dsp56k.c	2016-10-16 17:20:17.267039900 +0200
@@ -583,7 +583,7 @@
 static long _cdecl
 dsp56k_lseek(FILEPTR *f, long where, int whence)
 {
-	return 0;
+	return ESPIPE;
 }
 
 static long _cdecl


More information about the Freemint-list mailing list