Ignore SIGSYS when issuing pioctl syscall
authorAndrew Deason <adeason@sinenomine.net>
Tue, 14 Jul 2009 16:29:01 +0000 (11:29 -0500)
committerRuss Allbery <rra@stanford.edu>
Wed, 15 Jul 2009 17:46:37 +0000 (11:46 -0600)
Ignore SIGSYS when we issue the pioctl syscall, so we don't dump core
when the kernel module hasn't yet been installed on several platforms.
Also, restore the old SIGSYS signal handler afterwards, so we don't
cause any side-effects.

Reviewed-on: http://gerrit.openafs.org/81
Verified-by: Andrew Deason <adeason@sinenomine.net>
Verified-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Russ Allbery <rra@stanford.edu>

src/sys/pioctl.c

index 1df62ad..b1d64e5 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <signal.h>
 
 #include <afs/afs_args.h>
 #if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
@@ -48,10 +49,10 @@ int
 lpioctl(char *path, int cmd, char *cmarg, int follow)
 {
     int errcode, rval;
-#if defined(AFS_FBSD_ENV)
+#ifndef AFS_LINUX20_ENV
     /* As kauth/user.c says, handle smoothly the case where no AFS system call
-     *  exists (yet).  Why don't more platforms have trouble here?  Matt */
-    sig_t old = (int (*)())signal(SIGSYS, SIG_IGN);
+     * exists (yet). */
+    sig_t old = signal(SIGSYS, SIG_IGN);
 #endif
 
 #if defined(AFS_LINUX20_ENV)
@@ -70,6 +71,10 @@ lpioctl(char *path, int cmd, char *cmarg, int follow)
     errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg, follow);
 #endif
 
+#ifndef AFS_LINUX20_ENV
+    signal(SIGSYS, old);
+#endif
+
     return (errcode);
 }