Subject: cerror.S bug
To: None <port-vax@NetBSD.ORG>
From: Arne Henrik Juul <arnej@imf.unit.no>
List: port-vax
Date: 12/04/1995 17:33:29
[Note: I tried sending this with send-pr as a `port-vax' bug, but
nothing has shown up yet, so maybe that was a mistake.]

The problem: When lseek fails, the return value has garbage in the upper
32 bits.  This is because the cerror.S libc routine only returns -1 in r0.
This makes programs checking lseek() return values fail.

Here's a sample patch; assembly generated with gcc -S.
Someone with better knowledge of VAX assembly could perhaps come up
with something more effective.

  -  Arne H. J.

--- cerror.S.orig	Wed Oct 11 13:00:02 1995
+++ cerror.S	Mon Dec  4 01:27:04 1995
@@ -41,5 +41,5 @@
 	.globl	_errno
 cerror:
 	movl	r0,_errno
-	mnegl	$1,r0
+	movq	$0xffffffffffffffff,r0
 	ret