basic: add open_mkdir_at_full()
Add helper for open_mkdir_at() which accepts xopen flags, e.g. to pass XO_LABEL to create the target with the correct security context.
This commit is contained in:
+2
-2
@@ -1025,7 +1025,7 @@ int parse_cifs_service(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int open_mkdir_at(int dirfd, const char *path, int flags, mode_t mode) {
|
||||
int open_mkdir_at_full(int dirfd, const char *path, int flags, XOpenFlags xopen_flags, mode_t mode) {
|
||||
_cleanup_close_ int fd = -EBADF, parent_fd = -EBADF;
|
||||
_cleanup_free_ char *fname = NULL, *parent = NULL;
|
||||
int r;
|
||||
@@ -1061,7 +1061,7 @@ int open_mkdir_at(int dirfd, const char *path, int flags, mode_t mode) {
|
||||
path = fname;
|
||||
}
|
||||
|
||||
fd = xopenat_full(dirfd, path, flags|O_CREAT|O_DIRECTORY|O_NOFOLLOW, /* xopen_flags = */ 0, mode);
|
||||
fd = xopenat_full(dirfd, path, flags|O_CREAT|O_DIRECTORY|O_NOFOLLOW, xopen_flags, mode);
|
||||
if (IN_SET(fd, -ELOOP, -ENOTDIR))
|
||||
return -EEXIST;
|
||||
if (fd < 0)
|
||||
|
||||
Reference in New Issue
Block a user