From: Andrew Deason Date: Thu, 10 Nov 2011 17:58:12 +0000 (-0600) Subject: namei: Remove extraneous rmdir X-Git-Tag: upstream/1.6.1.pre1^2~99 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=34637cbc700df627550840aed81b7a42fe241bc8;p=packages%2Fo%2Fopenafs.git namei: Remove extraneous rmdir We just unlinked the file, so we know we won't be able to rmdir() the same thing. Give a path one level higher to namei_RemoveDataDirectories, so we start rmdir()ing at the parent dir. Reviewed-on: http://gerrit.openafs.org/5833 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit b41e30a55c8aeb6d7f42d74f9eb090232032057f) Change-Id: Ibd14490e2d85bd78522472203ad57120237bff22 Reviewed-on: http://gerrit.openafs.org/6079 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index 9a1076a3f..6b884f05d 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1063,6 +1063,11 @@ namei_dec(IHandle_t * ih, Inode ino, int p1) /* Try to remove directory. If it fails, that's ok. * Salvage will clean up. */ + char *slash = strrchr(name.n_path, OS_DIRSEPC); + if (slash) { + /* avoid an rmdir() on the file we just unlinked */ + *slash = '\0'; + } (void)namei_RemoveDataDirectories(&name); } }