label: tweak LabelOps post() hook to take "created" boolean
We have two distinct implementations of the post hook. 1. For SELinux we just reset the selinux label we told the kernel earlier to use for new inodes. 2. For SMACK we might apply an xattr to the specified file. The two calls are quite different: the first call we want to call in all cases (failure or success), the latter only if we actually managed to create an inode, in which case it is called on the inode.
This commit is contained in:
+2
-2
@@ -1184,7 +1184,7 @@ int xopenat_full(int dir_fd, const char *path, int open_flags, XOpenFlags xopen_
|
||||
made_dir = true;
|
||||
|
||||
if (FLAGS_SET(xopen_flags, XO_LABEL)) {
|
||||
r = label_ops_post(dir_fd, path);
|
||||
r = label_ops_post(dir_fd, path, made_dir);
|
||||
if (r < 0)
|
||||
goto error;
|
||||
}
|
||||
@@ -1211,7 +1211,7 @@ int xopenat_full(int dir_fd, const char *path, int open_flags, XOpenFlags xopen_
|
||||
}
|
||||
|
||||
if (FLAGS_SET(open_flags, O_CREAT) && FLAGS_SET(xopen_flags, XO_LABEL)) {
|
||||
r = label_ops_post(dir_fd, path);
|
||||
r = label_ops_post(dir_fd, path, made_file || made_dir);
|
||||
if (r < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user