summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-04-05 11:54:02 +0200
committerGitHub <noreply@github.com>2018-04-05 11:54:02 +0200
commit6064de2de8734401669b787b68ebbf858d452cec (patch)
tree61817c814390f491a6ec53245b4a30bea2008864 /src
parentba45959cb2b6e2476a2ad207b6609ce5fa8412b0 (diff)
parentc79b89e6eb5efaa69b7d8358c43373fb9fab0af6 (diff)
downloadsystemd-6064de2de8734401669b787b68ebbf858d452cec.tar.gz
Merge pull request #8617 from keszybz/tmpfiles-relax
Do not exit with error when systemd-tmpfiles --boot fails
Diffstat (limited to 'src')
-rw-r--r--src/basic/fd-util.h4
-rw-r--r--src/tmpfiles/tmpfiles.c20
2 files changed, 14 insertions, 10 deletions
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
index 163b096b1a..e75e954103 100644
--- a/src/basic/fd-util.h
+++ b/src/basic/fd-util.h
@@ -98,6 +98,10 @@ int acquire_data_fd(const void *data, size_t size, unsigned flags);
#define ERRNO_IS_DISCONNECT(r) \
IN_SET(r, ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, ENETUNREACH)
+/* Resource exhaustion, could be our fault or general system trouble */
+#define ERRNO_IS_RESOURCE(r) \
+ IN_SET(r, ENOMEM, EMFILE, ENFILE)
+
int fd_move_above_stdio(int fd);
int rearrange_stdio(int original_input_fd, int original_output_fd, int original_error_fd);
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 299012fc03..8dd52d140c 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1289,7 +1289,7 @@ static int write_one_file(Item *i, const char *path) {
fd = safe_close(fd);
-done:
+ done:
if (stat(path, &st) < 0)
return log_error_errno(errno, "stat(%s) failed: %m", path);
@@ -2725,7 +2725,7 @@ static int read_config_files(char **config_dirs, char **args, bool *invalid_conf
}
int main(int argc, char *argv[]) {
- int r, k;
+ int r, k, r_process = 0;
ItemArray *a;
Iterator iterator;
_cleanup_strv_free_ char **config_dirs = NULL;
@@ -2772,7 +2772,7 @@ int main(int argc, char *argv[]) {
t = strv_join(config_dirs, "\n\t");
if (t)
- log_debug("Looking for configuration files in (higher priority first:\n\t%s", t);
+ log_debug("Looking for configuration files in (higher priority first):\n\t%s", t);
}
/* If command line arguments are specified along with --replace, read all
@@ -2788,22 +2788,20 @@ int main(int argc, char *argv[]) {
if (r < 0)
goto finish;
-
-
/* The non-globbing ones usually create things, hence we apply
* them first */
ORDERED_HASHMAP_FOREACH(a, items, iterator) {
k = process_item_array(a);
- if (k < 0 && r == 0)
- r = k;
+ if (k < 0 && r_process == 0)
+ r_process = k;
}
/* The globbing ones usually alter things, hence we apply them
* second. */
ORDERED_HASHMAP_FOREACH(a, globs, iterator) {
k = process_item_array(a);
- if (k < 0 && r == 0)
- r = k;
+ if (k < 0 && r_process == 0)
+ r_process = k;
}
finish:
@@ -2818,10 +2816,12 @@ finish:
mac_selinux_finish();
- if (r < 0)
+ if (r < 0 || ERRNO_IS_RESOURCE(-r_process))
return EXIT_FAILURE;
else if (invalid_config)
return EX_DATAERR;
+ else if (r_process < 0)
+ return EX_CANTCREAT;
else
return EXIT_SUCCESS;
}