78383f
commit 3ccd774255b8215733e0bdfdf5a683da9dd10923
78383f
Author: Panu Matilainen <pmatilai@redhat.com>
78383f
Date:   Wed Sep 24 10:31:51 2014 +0300
78383f
78383f
    Handle directory replaced with a symlink to one in verify (RhBug:1101861)
78383f
    
78383f
    - An unforced installation must not cause verification failures - we
78383f
      permit directories to be replaced by directory symlinks during
78383f
      install so we need to do the same in verify too.
78383f
78383f
diff --git a/lib/verify.c b/lib/verify.c
78383f
index eb6f2e1..84e9843 100644
78383f
--- a/lib/verify.c
78383f
+++ b/lib/verify.c
78383f
@@ -96,6 +96,12 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
78383f
 	return 1;
78383f
     }
78383f
 
78383f
+    /* If we expected a directory but got a symlink to one, follow the link */
78383f
+    if (S_ISDIR(fmode) && S_ISLNK(sb.st_mode) && stat(fn, &sb) != 0) {
78383f
+	*res |= RPMVERIFY_LSTATFAIL;
78383f
+	return 1;
78383f
+    }
78383f
+
78383f
     /* Links have no mode, other types have no linkto */
78383f
     if (S_ISLNK(sb.st_mode))
78383f
 	flags &= ~(RPMVERIFY_MODE);