mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
mkdir-label: make mkdir_label() a wrapper around mkdirat_label()
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -14,8 +15,12 @@ static inline int label_fix(const char *path, LabelFixFlags flags) {
|
||||
return label_fix_container(path, path, flags);
|
||||
}
|
||||
|
||||
int mkdir_label(const char *path, mode_t mode);
|
||||
int mkdirat_label(int dirfd, const char *path, mode_t mode);
|
||||
|
||||
static inline int mkdir_label(const char *path, mode_t mode) {
|
||||
return mkdirat_label(AT_FDCWD, path, mode);
|
||||
}
|
||||
|
||||
int symlink_label(const char *old_path, const char *new_path);
|
||||
int symlink_atomic_label(const char *from, const char *to);
|
||||
int mknod_label(const char *pathname, mode_t mode, dev_t dev);
|
||||
|
||||
@@ -12,23 +12,6 @@
|
||||
#include "smack-util.h"
|
||||
#include "user-util.h"
|
||||
|
||||
int mkdir_label(const char *path, mode_t mode) {
|
||||
int r;
|
||||
|
||||
assert(path);
|
||||
|
||||
r = mac_selinux_create_file_prepare(path, S_IFDIR);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = mkdir_errno_wrapper(path, mode);
|
||||
mac_selinux_create_file_clear();
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return mac_smack_fix(path, 0);
|
||||
}
|
||||
|
||||
int mkdirat_label(int dirfd, const char *path, mode_t mode) {
|
||||
int r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user