summaryrefslogtreecommitdiff
blob: 714fbc09b5341ba4454b9d76b5eafa69e8da29fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
https://github.com/rpm-software-management/rpm/commit/6ad8a71407b173b6c50d389f01edd8a4aecd6807
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -1015,27 +1015,28 @@
             }
 
 setmeta:
-	    /* Special files require path-based ops */
-	    int mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
-	    if (!rc && fd == -1 && mayopen) {
-		int flags = O_RDONLY;
-		/* Only follow safe symlinks, and never on temporary files */
-		if (fp->suffix)
-		    flags |= AT_SYMLINK_NOFOLLOW;
-		fd = fsmOpenat(di.dirfd, fp->fpath, flags,
-				S_ISDIR(fp->sb.st_mode));
-		if (fd < 0)
-		    rc = RPMERR_OPEN_FAILED;
-	    }
+		{
+		    /* Special files require path-based ops */
+		    int mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
+		    if (!rc && fd == -1 && mayopen) {
+			int flags = O_RDONLY;
+			/* Only follow safe symlinks, and never on temporary files */
+			if (fp->suffix)
+			    flags |= AT_SYMLINK_NOFOLLOW;
+			fd = fsmOpenat(di.dirfd, fp->fpath, flags,
+					S_ISDIR(fp->sb.st_mode));
+			if (fd < 0)
+			    rc = RPMERR_OPEN_FAILED;
+		    }
+	        if (!rc && fp->setmeta) {
+	    		rc = fsmSetmeta(fd, di.dirfd, fp->fpath,
+	    			fi, plugins, fp->action,
+	    			&fp->sb, nofcaps);
+	        }
 
-	    if (!rc && fp->setmeta) {
-		rc = fsmSetmeta(fd, di.dirfd, fp->fpath,
-				fi, plugins, fp->action,
-				&fp->sb, nofcaps);
-	    }
-
-	    if (fd != firstlinkfile)
-		fsmClose(&fd);
+	        if (fd != firstlinkfile)
+	    		fsmClose(&fd);
+		}
 	}
 
 	/* Notify on success. */