[comp.os.minix] MINIX V1.3 /dev/null fix

ward@netcom.UUCP (Mike Ward) (06/21/89)

In article <18082@louie.udel.EDU> Guy Helmer writes:
>Does someone know where I can find the patch for the null device
>(/dev/null) in Minix 1.3?  I'm referring to the problem where
>cat /dev/null > a_file does not result in a file with 0 bytes,
>but a file that grows until you kill the cat command.  Thanks in
>advance.
>
>-- Guy Helmer                      BITNET: HELMER@SDNET
>   Dakota State College (11 days to being a University!!!)
>   Madison, SD                     AT&T: (605) 256-5315


I don't really know of an offical patch for this, but I had the same problem
and the solution is a one-liner. If you look in kernel/memory.c you will 
find the following line of code:

	if (device==NULL_DEV)
		return (m_ptr->m_type == DISK_READ ? 0 : m_ptr->count);

The problem is that if the operation type is DISK_READ then the value EOF
should be returned rather than 0. To fix it, simply change the 0 to EOF.
Hope this helps.