From: Simon Wilkinson Date: Mon, 29 Aug 2011 22:36:41 +0000 (+0100) Subject: libafs: Fix directory verification X-Git-Tag: upstream/1.8.0_pre1^2~3328 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=b298138bc49c1d1dae0495e03f4a561f0bd5dd82;p=packages%2Fo%2Fopenafs.git libafs: Fix directory verification With the earlier directory verification changes, every directory was seen as corrupt, because the nde pointer was never being initialised Rework the way that we check for the failure of afs_dir_GetVerifiedBlob so that we can more robustly detect problems, whilst still allowing normal directories to be browsed as before Change-Id: I3d3f428025296956b5feff6ba290aaef79817dcd Reviewed-on: http://gerrit.openafs.org/5318 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index f2f0a84ef..f0572b958 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -741,9 +741,10 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred) us = BlobScan(tdc, (origOffset >> 5)); if (us) - afs_dir_GetVerifiedBlob(tdc, us, &nextEntry); + code = afs_dir_GetVerifiedBlob(tdc, us, &nextEntry); - if (us == 0 || nde == NULL) { + if (us == 0 || code != 0) { + code = 0; /* Reset code - keep old failure behaviour */ /* failed to setup nde, return what we've got, and release ode */ if (len) { /* something to hand over. */