From 5047acfdd3aeb145d57e0808fcc4171a757b44af Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Wed, 28 Aug 2002 05:49:18 +0000 Subject: [PATCH] Work around MacOSX Finder's behavior by returning ENOENT when the user tries to look up Contents or .DS_Store in an uncached volume root. (cherry picked from commit 77b1a76e47948422c7797de2ac27f3a121aa8806) --- src/afs/VNOPS/afs_vnop_lookup.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 98f13a6a8..c47181c95 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -1088,6 +1088,7 @@ afs_lookup(adp, aname, avcp, acred) struct sysname_info sysState; /* used only for @sys checking */ int dynrootRetry = 1; struct afs_fakestat_state fakestate; + int tryEvalOnly = 0; AFS_STATCNT(afs_lookup); afs_InitFakeStat(&fakestate); @@ -1095,15 +1096,33 @@ afs_lookup(adp, aname, avcp, acred) if (code = afs_InitReq(&treq, acred)) goto done; - code = afs_EvalFakeStat(&adp, &fakestate, &treq); - if (code) - goto done; #ifdef AFS_OSF_ENV ndp->ni_dvp = AFSTOV(adp); memcpy(aname, ndp->ni_ptr, ndp->ni_namelen); aname[ndp->ni_namelen] = '\0'; #endif /* AFS_OSF_ENV */ +#if defined(AFS_DARWIN_ENV) + /* Workaround for MacOSX Finder, which tries to look for + * .DS_Store and Contents under every directory. + */ + if (afs_fakestat_enable && adp->mvstat == 1) { + if (strcmp(aname, ".DS_Store") == 0) + tryEvalOnly = 1; + if (strcmp(aname, "Contents") == 0) + tryEvalOnly = 1; + } +#endif + + if (tryEvalOnly) + code = afs_TryEvalFakeStat(&adp, &fakestate, &treq); + else + code = afs_EvalFakeStat(&adp, &fakestate, &treq); + if (tryEvalOnly && adp->mvstat == 1) + code = ENOENT; + if (code) + goto done; + *avcp = (struct vcache *) 0; /* Since some callers don't initialize it */ /* come back to here if we encounter a non-existent object in a read-only -- 2.39.5