systemd/0029-tmpfiles-create-directories-already-with-the-right-l.patch

33 lines
1.3 KiB
Diff
Raw Normal View History

2014-06-23 04:30:03 +00:00
From 22549162275fdd36e978a209469772997397f9d7 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 18 Jun 2014 00:02:08 +0200
Subject: [PATCH] tmpfiles: create directories already with the right label,
instead of creating them first, and relabeling them afterwards
(cherry picked from commit 6f04529399a7a59cfe549913349176409a4dc2e3)
---
src/tmpfiles/tmpfiles.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 3e817cca..7950354d 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -693,12 +693,12 @@ static int create_item(Item *i) {
RUN_WITH_UMASK(0000) {
mkdir_parents_label(i->path, 0755);
- r = mkdir(i->path, i->mode);
+ r = mkdir_label(i->path, i->mode);
}
- if (r < 0 && errno != EEXIST) {
- log_error("Failed to create directory %s: %m", i->path);
- return -errno;
+ if (r < 0 && r != -EEXIST) {
+ log_error("Failed to create directory %s: %s", i->path, strerror(-r));
+ return r;
}
if (stat(i->path, &st) < 0) {