summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-10-14 19:41:27 +0200
committerGitHub <noreply@github.com>2020-10-14 19:41:27 +0200
commit1008f5b069d574ce1ebe18572fda30ac964ba147 (patch)
tree31fd6f73a8574c2fb7f6a7e8d02f30c90d5325c6
parent21ad3318737577af0906a13c31e48ac18ec6a8f3 (diff)
parent670eed4c8ca36505fc93ff140341ccb9c04510f4 (diff)
downloadsystemd-1008f5b069d574ce1ebe18572fda30ac964ba147.tar.gz
Merge pull request #17351 from poettering/exec-rt-typo-fix
fix one character typo in execute.c
-rw-r--r--src/core/execute.c25
-rw-r--r--src/core/manager.c18
2 files changed, 37 insertions, 6 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index d21de8c41e..98e54acf77 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -6068,7 +6068,12 @@ static int exec_runtime_add(
return 0;
}
-static int exec_runtime_make(Manager *m, const ExecContext *c, const char *id, ExecRuntime **ret) {
+static int exec_runtime_make(
+ Manager *m,
+ const ExecContext *c,
+ const char *id,
+ ExecRuntime **ret) {
+
_cleanup_(namespace_cleanup_tmpdirp) char *tmp_dir = NULL, *var_tmp_dir = NULL;
_cleanup_close_pair_ int netns_storage_socket[2] = { -1, -1 };
int r;
@@ -6078,8 +6083,10 @@ static int exec_runtime_make(Manager *m, const ExecContext *c, const char *id, E
assert(id);
/* It is not necessary to create ExecRuntime object. */
- if (!c->private_network && !c->private_tmp && !c->network_namespace_path)
+ if (!c->private_network && !c->private_tmp && !c->network_namespace_path) {
+ *ret = NULL;
return 0;
+ }
if (c->private_tmp &&
!(prefixed_path_strv_contains(c->inaccessible_paths, "/tmp") &&
@@ -6115,14 +6122,20 @@ int exec_runtime_acquire(Manager *m, const ExecContext *c, const char *id, bool
/* We already have a ExecRuntime object, let's increase the ref count and reuse it */
goto ref;
- if (!create)
+ if (!create) {
+ *ret = NULL;
return 0;
+ }
/* If not found, then create a new object. */
r = exec_runtime_make(m, c, id, &rt);
- if (r <= 0)
- /* When r == 0, it is not necessary to create ExecRuntime object. */
+ if (r < 0)
return r;
+ if (r == 0) {
+ /* When r == 0, it is not necessary to create ExecRuntime object. */
+ *ret = NULL;
+ return 0;
+ }
ref:
/* increment reference counter. */
@@ -6348,7 +6361,7 @@ int exec_runtime_deserialize_one(Manager *m, const char *value, FDSet *fds) {
r = safe_atoi(buf, &fdpair[1]);
if (r < 0)
return log_debug_errno(r, "Unable to parse exec-runtime specification netns-socket-1=%s: %m", buf);
- if (!fdset_contains(fds, fdpair[0]))
+ if (!fdset_contains(fds, fdpair[1]))
return log_debug_errno(SYNTHETIC_ERRNO(EBADF),
"exec-runtime specification netns-socket-1= refers to unknown fd %d: %m", fdpair[1]);
fdpair[1] = fdset_remove(fds, fdpair[1]);
diff --git a/src/core/manager.c b/src/core/manager.c
index d85d938e7b..6a8c4bf362 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -3492,6 +3492,24 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
assert(m);
assert(f);
+ if (DEBUG_LOGGING) {
+ if (fdset_isempty(fds))
+ log_debug("No file descriptors passed");
+ else {
+ int fd;
+
+ FDSET_FOREACH(fd, fds) {
+ _cleanup_free_ char *fn = NULL;
+
+ r = fd_get_path(fd, &fn);
+ if (r < 0)
+ log_debug_errno(r, "Received serialized fd %i → %m", fd);
+ else
+ log_debug("Received serialized fd %i → %s", fd, strna(fn));
+ }
+ }
+ }
+
log_debug("Deserializing state...");
/* If we are not in reload mode yet, enter it now. Not that this is recursive, a caller might already have