diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-03-01 09:37:41 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-03-01 22:52:55 +0000 |
commit | 1406bd66e4dbb5dd0130d9327ffd588652cbe228 (patch) | |
tree | 07e98957ce839227aa8a386c3596a7f9f121d3a3 /src/core/execute.c | |
parent | 8c7a6c742afef9284d5c06fc285cf66306cbce31 (diff) | |
download | systemd-1406bd66e4dbb5dd0130d9327ffd588652cbe228.tar.gz |
tree-wide: error handling modernizations
Diffstat (limited to 'src/core/execute.c')
-rw-r--r-- | src/core/execute.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index e23faf25bd..dda8736804 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -4655,11 +4655,13 @@ static int exec_child( if (mpol_is_valid(numa_policy_get_type(&context->numa_policy))) { r = apply_numa_policy(&context->numa_policy); - if (r == -EOPNOTSUPP) - log_unit_debug_errno(unit, r, "NUMA support not available, ignoring."); - else if (r < 0) { - *exit_status = EXIT_NUMA_POLICY; - return log_unit_error_errno(unit, r, "Failed to set NUMA memory policy: %m"); + if (r < 0) { + if (ERRNO_IS_NOT_SUPPORTED(r)) + log_unit_debug_errno(unit, r, "NUMA support not available, ignoring."); + else { + *exit_status = EXIT_NUMA_POLICY; + return log_unit_error_errno(unit, r, "Failed to set NUMA memory policy: %m"); + } } } @@ -4917,12 +4919,14 @@ static int exec_child( if (ns_type_supported(NAMESPACE_NET)) { r = setup_shareable_ns(runtime->netns_storage_socket, CLONE_NEWNET); - if (r == -EPERM) - log_unit_warning_errno(unit, r, - "PrivateNetwork=yes is configured, but network namespace setup failed, ignoring: %m"); - else if (r < 0) { - *exit_status = EXIT_NETWORK; - return log_unit_error_errno(unit, r, "Failed to set up network namespacing: %m"); + if (r < 0) { + if (ERRNO_IS_PRIVILEGE(r)) + log_unit_warning_errno(unit, r, + "PrivateNetwork=yes is configured, but network namespace setup failed, ignoring: %m"); + else { + *exit_status = EXIT_NETWORK; + return log_unit_error_errno(unit, r, "Failed to set up network namespacing: %m"); + } } } else if (context->network_namespace_path) { *exit_status = EXIT_NETWORK; |