From: Andrew Deason Date: Tue, 8 Jun 2010 15:38:07 +0000 (-0500) Subject: Solaris: lookup "" like "." X-Git-Tag: openafs-devel-1_5_75~176 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=8d18d4773a256b5bb567752e7f923b7713107cb0;p=packages%2Fo%2Fopenafs.git Solaris: lookup "" like "." At least on some versions of solaris, we can get passed an empty string to afs_lookup, if the root directory is in AFS (e.g. after a chroot). Interpret this as the same as looking up the "." entry; otherwise we return ENOENT, implying that the "/" directory does not exist, even if its subdirectories do. FIXES 127356 Change-Id: I84283e78fbf33b946afaf3c80ef4a1a679e8fc93 Reviewed-on: http://gerrit.openafs.org/2096 Tested-by: Andrew Deason Reviewed-by: Simon Wilkinson Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 630b64390..82e023405 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -1288,6 +1288,23 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) /* was: (AFS_DEC_ENV) || defined(AFS_OSF30_ENV) || defined(AFS_NCR_ENV) */ static int AFSDOBULK = 1; +static_inline int +osi_lookup_isdot(const char *aname) +{ +#ifdef AFS_SUN5_ENV + if (!aname[0]) { + /* in Solaris, we can get passed "" as a path component if we are the + * root directory, e.g. after a call to chroot. It is equivalent to + * looking up "." */ + return 1; + } +#endif /* AFS_SUN5_ENV */ + if (aname[0] == '.' && !aname[1]) { + return 1; + } + return 0; +} + int #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct pathname *pnp, int flags, struct vnode *rdir, afs_ucred_t *acred) @@ -1415,7 +1432,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr * I'm not fiddling with the LRUQ here, either, perhaps I should, or else * invent a lightweight version of GetVCache. */ - if (aname[0] == '.' && !aname[1]) { /* special case */ + if (osi_lookup_isdot(aname)) { /* special case */ ObtainReadLock(&afs_xvcache); osi_vnhold(adp, 0); ReleaseReadLock(&afs_xvcache);