summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/automount.c2
-rw-r--r--src/label.c6
-rw-r--r--src/label.h3
-rw-r--r--src/mount-setup.c4
-rw-r--r--src/tmpfiles.c2
5 files changed, 11 insertions, 6 deletions
diff --git a/src/automount.c b/src/automount.c
index 9447c0d8fc..7289311684 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -305,7 +305,7 @@ static int open_dev_autofs(Manager *m) {
if (m->dev_autofs_fd >= 0)
return m->dev_autofs_fd;
- label_fix("/dev/autofs");
+ label_fix("/dev/autofs", false);
if ((m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY)) < 0) {
log_error("Failed to open /dev/autofs: %s", strerror(errno));
diff --git a/src/label.c b/src/label.c
index 218d0dfa06..09ded642fb 100644
--- a/src/label.c
+++ b/src/label.c
@@ -65,7 +65,7 @@ int label_init(void) {
return r;
}
-int label_fix(const char *path) {
+int label_fix(const char *path, bool ignore_enoent) {
int r = 0;
#ifdef HAVE_SELINUX
@@ -90,6 +90,10 @@ int label_fix(const char *path) {
/* If the FS doesn't support labels, then exit without warning */
if (r < 0 && errno == ENOTSUP)
return 0;
+
+ /* Ignore ENOENT in some cases */
+ if (r < 0 && ignore_enoent && errno == ENOENT)
+ return 0;
}
}
diff --git a/src/label.h b/src/label.h
index f1bf5d6d5e..7ea11cdc55 100644
--- a/src/label.h
+++ b/src/label.h
@@ -23,11 +23,12 @@
***/
#include <sys/types.h>
+#include <stdbool.h>
int label_init(void);
void label_finish(void);
-int label_fix(const char *path);
+int label_fix(const char *path, bool ignore_enoent);
int label_socket_set(const char *label);
void label_socket_clear(void);
diff --git a/src/mount-setup.c b/src/mount-setup.c
index 64fb4765f6..5cbaee6be7 100644
--- a/src/mount-setup.c
+++ b/src/mount-setup.c
@@ -121,7 +121,7 @@ static int mount_one(const MountPoint *p) {
return p->fatal ? -errno : 0;
}
- label_fix(p->where);
+ label_fix(p->where, false);
return 0;
}
@@ -216,7 +216,7 @@ static int nftw_cb(
if (ftwbuf->level == 0)
return 0;
- label_fix(fpath);
+ label_fix(fpath, true);
return 0;
};
diff --git a/src/tmpfiles.c b/src/tmpfiles.c
index 917747a4a4..0302262394 100644
--- a/src/tmpfiles.c
+++ b/src/tmpfiles.c
@@ -507,7 +507,7 @@ static int create_item(Item *i) {
break;
}
- if ((r = label_fix(i->path)) < 0)
+ if ((r = label_fix(i->path, false)) < 0)
goto finish;
log_debug("%s created successfully.", i->path);