pioctl.c: removed unused variable
authorBenjamin Kaduk <kaduk@mit.edu>
Thu, 6 Feb 2014 21:11:49 +0000 (16:11 -0500)
committerD Brashear <shadow@your-file-system.com>
Tue, 25 Mar 2014 16:54:50 +0000 (09:54 -0700)
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 <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

src/sys/pioctl.c

index 98dd560..8bb6424 100644 (file)
@@ -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 */