From 6f5dc12bb278998049943c429ebafb5ec840033b Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Thu, 6 Feb 2014 16:11:49 -0500 Subject: [PATCH] pioctl.c: removed unused variable The 'rval' variable is only actually used in the LINUX20 case; adding another conditional block is making the LINUX20 case different enough that it should get split out entirely. Doing so lets the 'else' clause be simpler. Found by clang on FreeBSD 10.0. Reviewed-on: http://gerrit.openafs.org/10819 Tested-by: Benjamin Kaduk Reviewed-by: Perry Ruiter Reviewed-by: D Brashear (cherry picked from commit b9fb9c62a6779aa997259ddf2a83a90b08e04d5f) Change-Id: I47f781bc13d54ad5a1b34365fcb9680793b206d1 Reviewed-on: http://gerrit.openafs.org/11778 Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- src/sys/pioctl.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/sys/pioctl.c b/src/sys/pioctl.c index 3c0d8af38..aabfd0995 100644 --- a/src/sys/pioctl.c +++ b/src/sys/pioctl.c @@ -36,8 +36,7 @@ * need to do anything! */ -#else -#if defined(AFS_SGI_ENV) +#elif defined(AFS_SGI_ENV) #pragma weak xlpioctl = lpioctl @@ -47,46 +46,47 @@ lpioctl(char *path, int cmd, void *cmarg, int follow) return (syscall(AFS_PIOCTL, path, cmd, cmarg, follow)); } -#else /* AFS_SGI_ENV */ +#elif defined(AFS_LINUX20_ENV) int lpioctl(char *path, int cmd, void *cmarg, int follow) { - int errcode, rval; -#ifndef AFS_LINUX20_ENV - /* As kauth/user.c says, handle smoothly the case where no AFS system call - * exists (yet). */ - void (*old)(int) = signal(SIGSYS, SIG_IGN); -#endif + int errcode = 0; + int rval; -#if defined(AFS_LINUX20_ENV) rval = proc_afs_syscall(AFSCALL_PIOCTL, (long)path, cmd, (long)cmarg, follow, &errcode); if(rval) errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg, follow); -#elif defined(AFS_DARWIN80_ENV) - rval = ioctl_afs_syscall(AFSCALL_PIOCTL, (long)path, cmd, (long)cmarg, - follow, 0, 0, &errcode); - if (rval) - errcode = rval; + + return (errcode); +} + +#else /* AFS_AIX32_ENV */ + +int +lpioctl(char *path, int cmd, void *cmarg, int follow) +{ + int errcode = 0; + /* As kauth/user.c says, handle smoothly the case where no AFS system call + * exists (yet). */ + void (*old)(int) = signal(SIGSYS, SIG_IGN); + +#if defined(AFS_DARWIN80_ENV) + errcode = ioctl_afs_syscall(AFSCALL_PIOCTL, (long)path, cmd, (long)cmarg, + follow, 0, 0, &errcode); #elif defined(AFS_SUN511_ENV) - rval = ioctl_sun_afs_syscall(AFSCALL_PIOCTL, (uintptr_t)path, cmd, - (uintptr_t)cmarg, follow, 0, 0, &errcode); - if (rval) { - errcode = rval; - } + errcode = ioctl_sun_afs_syscall(AFSCALL_PIOCTL, (uintptr_t)path, cmd, + (uintptr_t)cmarg, follow, 0, 0, &errcode); #else errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg, follow); #endif -#ifndef AFS_LINUX20_ENV signal(SIGSYS, old); -#endif return (errcode); } -#endif /* !AFS_SGI_ENV */ #endif /* !AFS_AIX32_ENV */ -- 2.39.5