summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-30 16:01:42 +0200
committerDaniel Mack <github@zonque.org>2015-09-30 16:01:42 +0200
commit6e8337580862037d0639961cb51ef82270c1a30f (patch)
treee19f7bdbb0db123d4c4cf190b714c6b18376576a /src/shared
parent1115d417067190d5144586e0147b5ca7a917227c (diff)
parent6404ecc8a2069742bfbede3dc27f8fdab18e2746 (diff)
Merge pull request #1418 from poettering/base-fs
base-fs: consider inability to create /root non-fatal
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/base-filesystem.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index ab6fc171b0..48492ed13d 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -34,12 +34,13 @@ typedef struct BaseFilesystem {
mode_t mode;
const char *target;
const char *exists;
+ bool ignore_failure;
} BaseFilesystem;
static const BaseFilesystem table[] = {
{ "bin", 0, "usr/bin\0", NULL },
{ "lib", 0, "usr/lib\0", NULL },
- { "root", 0755, NULL, NULL },
+ { "root", 0755, NULL, NULL, true },
{ "sbin", 0, "usr/sbin\0", NULL },
{ "usr", 0755, NULL, NULL },
{ "var", 0755, NULL, NULL },
@@ -104,8 +105,13 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
RUN_WITH_UMASK(0000)
r = mkdirat(fd, table[i].dir, table[i].mode);
- if (r < 0 && errno != EEXIST)
- return log_error_errno(errno, "Failed to create directory at %s/%s: %m", root, table[i].dir);
+ if (r < 0 && errno != EEXIST) {
+ log_full_errno(table[i].ignore_failure ? LOG_DEBUG : LOG_ERR, errno,
+ "Failed to create directory at %s/%s: %m", root, table[i].dir);
+
+ if (!table[i].ignore_failure)
+ return -errno;
+ }
if (uid != UID_INVALID || gid != UID_INVALID) {
if (fchownat(fd, table[i].dir, uid, gid, AT_SYMLINK_NOFOLLOW) < 0)