diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2024-04-27 21:22:02 +0200 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2024-04-29 18:14:41 +0200 |
commit | 22b768d127fbd4b5d87f6017e2afb07febca72f8 (patch) | |
tree | 7cf4d8acc8d43020c5fa550f89eb41441fa1ca3c /src/shared/label-util.h | |
parent | meson: define 's390' for 's390x' when building BPF objects (diff) | |
download | systemd-22b768d127fbd4b5d87f6017e2afb07febca72f8.tar.xz systemd-22b768d127fbd4b5d87f6017e2afb07febca72f8.zip |
basic: add mknodat_label()
Add helper for mknodat(2) which creates the destination with the correct
security label.
Diffstat (limited to 'src/shared/label-util.h')
-rw-r--r-- | src/shared/label-util.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/shared/label-util.h b/src/shared/label-util.h index 7fb98c7656..5a19a4cd43 100644 --- a/src/shared/label-util.h +++ b/src/shared/label-util.h @@ -21,7 +21,11 @@ int symlink_atomic_full_label(const char *from, const char *to, bool make_relati static inline int symlink_atomic_label(const char *from, const char *to) { return symlink_atomic_full_label(from, to, false); } -int mknod_label(const char *pathname, mode_t mode, dev_t dev); + +int mknodat_label(int dirfd, const char *pathname, mode_t mode, dev_t dev); +static inline int mknod_label(const char *pathname, mode_t mode, dev_t dev) { + return mknodat_label(AT_FDCWD, pathname, mode, dev); +} int btrfs_subvol_make_label(const char *path); |