From 9da7f3cc73bf990427a9dd80ba2bbbb618383ea3 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 9 Dec 2010 13:02:16 -0600 Subject: [PATCH] DARWIN: Fix setpag syscall error detection Darwin uses the same variable as the return value for ioctl_afs_syscall, and as the last 'out' parmater, so the return value for ioctl_afs_syscall will always overwrite whatever is written to the last 'out' parameter. Instead, record two different variables, and allow the returned error to overridte the error set as the last parameter. Change-Id: I7db1b226612c55c892810ce446b486b7e503529c Reviewed-on: http://gerrit.openafs.org/3497 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/sys/setpag.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sys/setpag.c b/src/sys/setpag.c index 169dafa983..8a36af5291 100644 --- a/src/sys/setpag.c +++ b/src/sys/setpag.c @@ -57,7 +57,12 @@ lsetpag(void) if(rval) errcode = syscall(AFS_SYSCALL, AFSCALL_SETPAG); #elif defined(AFS_DARWIN80_ENV) - errcode = ioctl_afs_syscall(AFSCALL_SETPAG,0,0,0,0,0,0,&errcode); + int rval; + + rval = ioctl_afs_syscall(AFSCALL_SETPAG,0,0,0,0,0,0,&errcode); + if (rval) { + errorcode = rval; + } #else errcode = syscall(AFS_SYSCALL, AFSCALL_SETPAG); #endif