]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
pioctl.c: removed unused variable
authorBenjamin Kaduk <kaduk@mit.edu>
Thu, 6 Feb 2014 21:11:49 +0000 (16:11 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 4 Mar 2016 12:33:54 +0000 (07:33 -0500)
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 <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
(cherry picked from commit b9fb9c62a6779aa997259ddf2a83a90b08e04d5f)

Change-Id: I47f781bc13d54ad5a1b34365fcb9680793b206d1
Reviewed-on: http://gerrit.openafs.org/11778
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/sys/pioctl.c

index 3c0d8af3877a0c2a521c5abdf7be849ab2545ee4..aabfd09950ec16057c7a8ec3e1b11fe5e51477d8 100644 (file)
@@ -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 */