V7 lseek bug?

M.J.Bayliss mjb at ukc.UUCP
Fri Mar 16 20:37:28 AEST 1984


I know of this bug in the EUUG V7 Small Machine Distribution
and the fix was published in the fix list for that distribution
in September 1980. I don't know if occurs in standard V7 systems.

To find out if you have the bug try

	main()
	{
		lseek(0,-1L,0);
	}

if running this logs you out - you have the bug.

The following fix is for the EUUG distribution line numbers
are probably different for standard V7, and even in the EUUG distribution
might vary depending on the number of other fixes you have applied.

1)	/usr/src/libc/sys/lseek.s

	line 19 reads
		mov $1,r1
	it should be
		mov $-1,r1

2)	/usr/sys/sys/sys2.c

	line 202 reads
		fp->f_un.f_offset = uap->off;
	before that line insert:
		if(uap->off < 0) {
			u.u_error = EINVALl
			uap->off = 0;
		}

3)	recompile every program which tests for lseek returning -1
	or stdio fseek returning -1

This fix was originally done by Hugh Conner.

	mike bayliss	university of kent
		...!vax135!ukc!mjb



More information about the Comp.unix.wizards mailing list