libafs: do not allow NULL creds for afs_CreateReq
[openafs.git] / src / afs / afs_osi_vget.c
index 40e0a9b..5fd36bf 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -14,8 +14,6 @@
 #include <afsconfig.h>
 #include "afs/param.h"
 
-RCSID
-    ("$Header$");
 
 #include "afs/sysincludes.h"   /* Standard vendor system headers */
 #include "afsincludes.h"       /* Afs-based standard headers */
@@ -23,22 +21,19 @@ RCSID
 
 
 
-#if !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV)
 /* This is the common part of the vget VFS call. */
 int
 afs_osi_vget(struct vcache **avcpp, struct fid *afidp, struct vrequest *areqp)
 {
     struct VenusFid vfid;
     struct SmallFid Sfid;
-    register struct cell *tcell;
-    struct vrequest treq;
-    register afs_int32 code = 0, cellindex;
+    struct cell *tcell;
+    struct vrequest *treq = NULL;
+    afs_int32 code = 0, cellindex;
     afs_int32 ret;
 
     memcpy((char *)&Sfid, afidp->fid_data, SIZEOF_SMALLFID);
-#ifdef AFS_OSF_ENV
-    Sfid.Vnode = afidp->fid_reserved;
-#endif
 
     /* Need to extract fid from SmallFid. Will need a wild card option for
      * finding the right vcache entry.
@@ -65,7 +60,11 @@ afs_osi_vget(struct vcache **avcpp, struct fid *afidp, struct vrequest *areqp)
        code = ENOENT;
     } else if (ret == 0) {
        /* didn't find an entry. */
-       *avcpp = afs_GetVCache(&vfid, &treq, NULL, NULL);
+       code = afs_CreateReq(&treq, afs_osi_credp);
+       if (code == 0) {
+           *avcpp = afs_GetVCache(&vfid, treq, NULL, NULL);
+           afs_DestroyReq(treq);
+       }
     }
     if (!*avcpp) {
        code = ENOENT;