From: Benjamin Kaduk Date: Thu, 6 Feb 2014 21:11:49 +0000 (-0500) Subject: pioctl.c: removed unused variable X-Git-Tag: openafs-stable-1_8_0pre1~749 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=b9fb9c62a6779aa997259ddf2a83a90b08e04d5f 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. Change-Id: I60c56af355fdb68752d9596ff2cd7a4259b43fe9 Reviewed-on: http://gerrit.openafs.org/10819 Tested-by: Benjamin Kaduk Reviewed-by: Perry Ruiter Reviewed-by: D Brashear --- diff --git a/src/sys/pioctl.c b/src/sys/pioctl.c index 98dd560..8bb6424 100644 --- a/src/sys/pioctl.c +++ b/src/sys/pioctl.c @@ -30,8 +30,7 @@ * need to do anything! */ -#else -#if defined(AFS_SGI_ENV) +#elif defined(AFS_SGI_ENV) #pragma weak xlpioctl = lpioctl @@ -41,46 +40,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 */