Merge pull request #15520 from mrc0mmand/various-codebase-improvements
tree-wide: various codebase improvements
This commit is contained in:
+1
-1
@@ -1201,7 +1201,7 @@ static VOID config_entry_parse_tries(
|
||||
}
|
||||
|
||||
new_factor = factor * 10;
|
||||
if (new_factor < factor) /* overflow chck */
|
||||
if (new_factor < factor) /* overflow check */
|
||||
return;
|
||||
|
||||
factor = new_factor;
|
||||
|
||||
+1
-1
@@ -1061,7 +1061,7 @@ int bus_foreach_bus(
|
||||
/* Send to all direct buses, unconditionally */
|
||||
SET_FOREACH(b, m->private_buses, i) {
|
||||
|
||||
/* Don't bother with enqueing these messages to clients that haven't started yet */
|
||||
/* Don't bother with enqueuing these messages to clients that haven't started yet */
|
||||
if (sd_bus_is_ready(b) <= 0)
|
||||
continue;
|
||||
|
||||
|
||||
+1
-1
@@ -2566,7 +2566,7 @@ static bool insist_on_sandboxing(
|
||||
assert(n_bind_mounts == 0 || bind_mounts);
|
||||
|
||||
/* Checks whether we need to insist on fs namespacing. i.e. whether we have settings configured that
|
||||
* would alter the view on the file system beyond making things read-only or invisble, i.e. would
|
||||
* would alter the view on the file system beyond making things read-only or invisible, i.e. would
|
||||
* rearrange stuff in a way we cannot ignore gracefully. */
|
||||
|
||||
if (context->n_temporary_filesystems > 0)
|
||||
|
||||
+2
-2
@@ -2860,13 +2860,13 @@ bool unit_job_is_applicable(Unit *u, JobType j) {
|
||||
case JOB_START:
|
||||
case JOB_NOP:
|
||||
/* Note that we don't check unit_can_start() here. That's because .device units and suchlike are not
|
||||
* startable by us but may appear due to external events, and it thus makes sense to permit enqueing
|
||||
* startable by us but may appear due to external events, and it thus makes sense to permit enqueuing
|
||||
* jobs for it. */
|
||||
return true;
|
||||
|
||||
case JOB_STOP:
|
||||
/* Similar as above. However, perpetual units can never be stopped (neither explicitly nor due to
|
||||
* external events), hence it makes no sense to permit enqueing such a request either. */
|
||||
* external events), hence it makes no sense to permit enqueuing such a request either. */
|
||||
return !u->perpetual;
|
||||
|
||||
case JOB_RESTART:
|
||||
|
||||
@@ -1521,7 +1521,7 @@ static int home_may_change_password(
|
||||
|
||||
r = user_record_test_password_change_required(h->record);
|
||||
if (IN_SET(r, -EKEYREVOKED, -EOWNERDEAD, -EKEYEXPIRED))
|
||||
return 0; /* expired in some form, but chaning is allowed */
|
||||
return 0; /* expired in some form, but changing is allowed */
|
||||
if (IN_SET(r, -EKEYREJECTED, -EROFS))
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Expiration settings of account %s do not allow changing of password.", h->user_name);
|
||||
if (r < 0)
|
||||
|
||||
+3
-4
@@ -1038,10 +1038,9 @@ static int home_remove(UserRecord *h) {
|
||||
|
||||
if (deleted)
|
||||
log_info("Everything completed.");
|
||||
else {
|
||||
log_notice("Nothing to remove.");
|
||||
return -EALREADY;
|
||||
}
|
||||
else
|
||||
return log_notice_errno(SYNTHETIC_ERRNO(EALREADY),
|
||||
"Nothing to remove.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ static int help(void) {
|
||||
" -p --priority=RANGE Show entries with the specified priority\n"
|
||||
" --facility=FACILITY... Show entries with the specified facilities\n"
|
||||
" -g --grep=PATTERN Show entries with MESSAGE matching PATTERN\n"
|
||||
" --case-sensitive[=BOOL] Force case sensitive or insenstive matching\n"
|
||||
" --case-sensitive[=BOOL] Force case sensitive or insensitive matching\n"
|
||||
" -e --pager-end Immediately jump to the end in the pager\n"
|
||||
" -f --follow Follow the journal\n"
|
||||
" -n --lines[=INTEGER] Number of journal entries to show\n"
|
||||
|
||||
@@ -141,8 +141,8 @@ int sd_dhcp_lease_get_servers(
|
||||
return (int) lease->smtp_server_size;
|
||||
|
||||
default:
|
||||
log_debug("Uknown DHCP lease info item %d.", what);
|
||||
return -ENXIO;
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENXIO),
|
||||
"Unknown DHCP lease info item %d.", what);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1162,8 +1162,8 @@ int sd_dhcp_server_set_servers(
|
||||
break;
|
||||
|
||||
default:
|
||||
log_debug("Uknown DHCP lease info item %d.", what);
|
||||
return -ENXIO;
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENXIO),
|
||||
"Unknown DHCP lease info item %d.", what);
|
||||
}
|
||||
|
||||
if (*n_a == n_addresses &&
|
||||
|
||||
@@ -106,7 +106,7 @@ _public_ struct udev *udev_unref(struct udev *udev) {
|
||||
assert(udev->n_ref > 0);
|
||||
udev->n_ref--;
|
||||
if (udev->n_ref > 0)
|
||||
/* This is different from our convetion, but let's keep backward
|
||||
/* This is different from our convention, but let's keep backward
|
||||
* compatibility. So, do not use DEFINE_PUBLIC_TRIVIAL_UNREF_FUNC()
|
||||
* macro to define this function. */
|
||||
return udev;
|
||||
|
||||
@@ -128,7 +128,7 @@ static int link_push_uplink_to_dhcp_server(
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_not_reached("Uknown DHCP lease info item");
|
||||
assert_not_reached("Unknown DHCP lease info item");
|
||||
}
|
||||
|
||||
char **a;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
* cgrouspv1 crap: kernel, kernelTCP, swapiness, disableOOMKiller, swap, devices, leafWeight
|
||||
* general: it shouldn't leak lower level abstractions this obviously
|
||||
* unmanagable cgroups stuff: realtimeRuntime/realtimePeriod
|
||||
* needs to say what happense when some option is not specified, i.e. which defautls apply
|
||||
* needs to say what happense when some option is not specified, i.e. which defaults apply
|
||||
* no architecture? no personality?
|
||||
* seccomp example and logic is simply broken: there's no constant "SCMP_ACT_ERRNO".
|
||||
* spec should say what to do with unknown props
|
||||
|
||||
@@ -151,7 +151,7 @@ int bind_remount_recursive_with_mountinfo(
|
||||
* operation). If it isn't we first make it one. Afterwards we apply MS_BIND|MS_RDONLY (or remove MS_RDONLY) to
|
||||
* all submounts we can access, too. When mounts are stacked on the same mount point we only care for each
|
||||
* individual "top-level" mount on each point, as we cannot influence/access the underlying mounts anyway. We
|
||||
* do not have any effect on future submounts that might get propagated, they migt be writable. This includes
|
||||
* do not have any effect on future submounts that might get propagated, they might be writable. This includes
|
||||
* future submounts that have been triggered via autofs.
|
||||
*
|
||||
* If the "blacklist" parameter is specified it may contain a list of subtrees to exclude from the
|
||||
|
||||
@@ -1334,7 +1334,7 @@ int varlink_invoke(Varlink *v, const char *method, JsonVariant *parameters) {
|
||||
if (v->state == VARLINK_DISCONNECTED)
|
||||
return -ENOTCONN;
|
||||
|
||||
/* We allow enqueing multiple method calls at once! */
|
||||
/* We allow enqueuing multiple method calls at once! */
|
||||
if (!IN_SET(v->state, VARLINK_IDLE_CLIENT, VARLINK_AWAITING_REPLY))
|
||||
return -EBUSY;
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ usec_t watchdog_runtime_wait(void) {
|
||||
if (!timestamp_is_set(watchdog_timeout))
|
||||
return USEC_INFINITY;
|
||||
|
||||
/* Sleep half the watchdog timeout since the last succesful ping at most */
|
||||
/* Sleep half the watchdog timeout since the last successful ping at most */
|
||||
if (timestamp_is_set(watchdog_last_ping)) {
|
||||
ntime = now(clock_boottime_or_monotonic());
|
||||
assert(ntime >= watchdog_last_ping);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
_SD_BEGIN_DECLARATIONS;
|
||||
|
||||
/* Neightbor Discovery Options, RFC 4861, Section 4.6 and
|
||||
/* Neighbor Discovery Options, RFC 4861, Section 4.6 and
|
||||
* https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml#icmpv6-parameters-5 */
|
||||
enum {
|
||||
SD_NDISC_OPTION_SOURCE_LL_ADDRESS = 1,
|
||||
|
||||
@@ -1058,7 +1058,8 @@ static void verify_one(
|
||||
r = unit_file_verify_alias(i, alias, &alias2);
|
||||
log_info_errno(r, "alias %s ← %s: %d/%m (expected %d)%s%s%s",
|
||||
i->name, alias, r, expected,
|
||||
alias2 ? " [" : "", alias2 ?: "", alias2 ? "]" : "");
|
||||
alias2 ? " [" : "", strempty(alias2),
|
||||
alias2 ? "]" : "");
|
||||
assert(r == expected);
|
||||
|
||||
/* This is is test for "instance propagation". This propagation matters mostly for WantedBy= and
|
||||
|
||||
@@ -30,7 +30,7 @@ static void test_proc_cmdline_override(void) {
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
assert_se(putenv((char*) "SYSTEMD_PROC_CMDLINE=foo_bar=quux wuff-piep=tuet zumm some_arg_with_space='foo bar' and_one_more=\"zzz aaa\"") == 0);
|
||||
assert_se(putenv((char*) "SYSTEMD_EFI_OPTIONS=differnt") == 0);
|
||||
assert_se(putenv((char*) "SYSTEMD_EFI_OPTIONS=different") == 0);
|
||||
|
||||
/* First test if the overrides for /proc/cmdline still work */
|
||||
_cleanup_free_ char *line = NULL, *value = NULL;
|
||||
|
||||
Reference in New Issue
Block a user