Merge pull request #17351 from poettering/exec-rt-typo-fix

fix one character typo in execute.c
This commit is contained in:
Lennart Poettering 2020-10-14 19:41:27 +02:00 committed by GitHub
commit 1008f5b069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 6 deletions

View File

@ -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]);

View File

@ -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