summaryrefslogtreecommitdiff
path: root/src/basic/label.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-12-15 17:08:13 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:49:41 +0200
commit8e1ffe8d484591f472e438611bbe19df24d6246e (patch)
treeb1dace5b8ecd3bf3c3105e5be3ab5fb53313359a /src/basic/label.c
parent03903826f35bba1c8b028b1235c2f006fdebd244 (diff)
Add mkdir_errno_wrapper() and use instead of mkdir() in various places
We'd pass pointers to mkdir and mkdir_label to call in various places. mkdir returns the error in errno while mkdir_label returns the error directly.
Diffstat (limited to 'src/basic/label.c')
-rw-r--r--src/basic/label.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/basic/label.c b/src/basic/label.c
index 8a2d87818..19d2bca10 100644
--- a/src/basic/label.c
+++ b/src/basic/label.c
@@ -22,7 +22,6 @@
#include <sys/stat.h>
#include <unistd.h>
-//#include "btrfs-util.h"
#include "label.h"
#include "macro.h"
#include "selinux-util.h"
@@ -51,11 +50,8 @@ int mkdir_label(const char *path, mode_t mode) {
if (r < 0)
return r;
- if (mkdir(path, mode) < 0)
- r = -errno;
-
+ r = mkdir_errno_wrapper(path, mode);
mac_selinux_create_file_clear();
-
if (r < 0)
return r;
@@ -84,21 +80,3 @@ int symlink_label(const char *old_path, const char *new_path) {
return mac_smack_fix(new_path, false, false);
}
#endif // 0
-
-int btrfs_subvol_make_label(const char *path) {
- int r;
-
- assert(path);
-
- r = mac_selinux_create_file_prepare(path, S_IFDIR);
- if (r < 0)
- return r;
-
- r = btrfs_subvol_make(path);
- mac_selinux_create_file_clear();
-
- if (r < 0)
- return r;
-
- return mac_smack_fix(path, false, false);
-}