[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: two bugs fixed in ramfs 1.4



Howard Chu <hyc@hanauma.jpl.nasa.gov> writes:
  
|>   Most of the device drivers existing for MiNT (procfs.c, shmfs.c,
|>   clockdev.c) assume that Fseek(offset,handle,2) will put the pointer
|>   "offset" bytes _before_ the end of the file.  Therefore, "offset" should
|>   be positive.  Ramfs also follows this convention.  Minixfs probably
|>   follows the opposite convention, since it works with stzip. 
  
|>   [ We could make the program more bomb-proof by considering only the
|>   absolute magnitude of "offset"; but in ramfs you should also be able to
|>   seek past the end of a file, so it's not desirable. ]

|> Well, lseek in Unix says the offset is added to the specified position
|> (beginning, current, end), so this would seem to be a pervasive bug.

Yes, this is a *major* bug. Even GEMDOS gets it right :-)
Everyone should apply this patch as soon as possible :-/

diff -ur orig/procfs.c ./procfs.c
--- orig/procfs.c	Sat Nov 20 01:39:58 1993
+++ ./procfs.c	Tue Nov 30 10:52:00 1993
@@ -698,10 +698,8 @@
 		f->pos = where;
 		break;
 	case 1:
-		f->pos += where;
-		break;
 	case 2:
-		f->pos = -where;
+		f->pos += where;
 		break;
 	default:
 		return EINVFN;
diff -ur orig/shmfs.c ./shmfs.c
--- orig/shmfs.c	Fri Jun 25 23:23:36 1993
+++ ./shmfs.c	Tue Nov 30 10:52:56 1993
@@ -653,10 +653,8 @@
 		newpos = where;
 		break;
 	case 1:
-		newpos = f->pos + where;
-		break;
 	case 2:
-		newpos = maxpos - where;
+		newpos = f->pos + where;
 		break;
 	default:
 		return EINVFN;