afs-dont-shutdown-if-not-started-20040728
[openafs.git] / src / afs / afs_call.c
index c5c613b..0c8e90d 100644 (file)
@@ -355,7 +355,7 @@ afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6)
        /* only root can run this code */
        return (EACCES);
 #else
-    if (!afs_suser() && (parm != AFSOP_GETMTU)
+    if (!afs_suser(NULL) && (parm != AFSOP_GETMTU)
        && (parm != AFSOP_GETMASK)) {
        /* only root can run this code */
 #if defined(KERNEL_HAVE_UERROR)
@@ -1510,6 +1510,11 @@ afs_shutdown(void)
     extern struct osi_file *afs_cacheInodep;
 
     AFS_STATCNT(afs_shutdown);
+    if (afs_initState == 0) {
+        afs_warn("AFS not initialized - not shutting down\n");
+      return;
+    }
+
     if (afs_shuttingdown)
        return;
     afs_shuttingdown = 1;
@@ -1694,7 +1699,7 @@ Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval)
        return (EACCES);
     }
 #else
-    if (!afs_suser()) {                /* only root can run this code */
+    if (!afs_suser(NULL)) {    /* only root can run this code */
 #if defined(KERNEL_HAVE_UERROR)
        setuerror(EACCES);
        return EACCES;