mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
core: do not include names directly in error messages
This allows some strings constants to be deduplicated. libsystemd-core.so + systemd are about 2k smaller. Also tweak some messages for consistency. We used 'exec' in one place and 'execute' in all other messages.
This commit is contained in:
@@ -1619,7 +1619,7 @@ static void redirect_telinit(int argc, char *argv[]) {
|
||||
return;
|
||||
|
||||
execv(SYSTEMCTL_BINARY_PATH, argv);
|
||||
log_error_errno(errno, "Failed to exec " SYSTEMCTL_BINARY_PATH ": %m");
|
||||
log_error_errno(errno, "Failed to execute %s: %m", SYSTEMCTL_BINARY_PATH);
|
||||
exit(EXIT_FAILURE);
|
||||
#endif
|
||||
}
|
||||
@@ -2604,12 +2604,12 @@ static int do_queue_default_job(
|
||||
/* Fall back to default.target, which we used to always use by default. Only do this if no
|
||||
* explicit configuration was given. */
|
||||
|
||||
log_info("Falling back to " SPECIAL_DEFAULT_TARGET ".");
|
||||
log_info("Falling back to %s.", SPECIAL_DEFAULT_TARGET);
|
||||
|
||||
r = manager_load_startable_unit_or_warn(m, SPECIAL_DEFAULT_TARGET, NULL, &target);
|
||||
}
|
||||
if (r < 0) {
|
||||
log_info("Falling back to " SPECIAL_RESCUE_TARGET ".");
|
||||
log_info("Falling back to %s.", SPECIAL_RESCUE_TARGET);
|
||||
|
||||
r = manager_load_startable_unit_or_warn(m, SPECIAL_RESCUE_TARGET, NULL, &target);
|
||||
if (r < 0) {
|
||||
|
||||
@@ -2034,10 +2034,9 @@ static void mount_enumerate_perpetual(Manager *m) {
|
||||
u = manager_get_unit(m, SPECIAL_ROOT_MOUNT);
|
||||
if (!u) {
|
||||
r = unit_new_for_name(m, sizeof(Mount), SPECIAL_ROOT_MOUNT, &u);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to allocate the special " SPECIAL_ROOT_MOUNT " unit: %m");
|
||||
return;
|
||||
}
|
||||
if (r < 0)
|
||||
return (void) log_error_errno(r, "Failed to allocate the special %s unit: %m",
|
||||
SPECIAL_ROOT_MOUNT);
|
||||
}
|
||||
|
||||
u->perpetual = true;
|
||||
|
||||
@@ -705,10 +705,9 @@ static void scope_enumerate_perpetual(Manager *m) {
|
||||
u = manager_get_unit(m, SPECIAL_INIT_SCOPE);
|
||||
if (!u) {
|
||||
r = unit_new_for_name(m, sizeof(Scope), SPECIAL_INIT_SCOPE, &u);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to allocate the special " SPECIAL_INIT_SCOPE " unit: %m");
|
||||
return;
|
||||
}
|
||||
if (r < 0)
|
||||
return (void) log_error_errno(r, "Failed to allocate the special %s unit: %m",
|
||||
SPECIAL_INIT_SCOPE);
|
||||
}
|
||||
|
||||
u->transient = true;
|
||||
|
||||
@@ -819,12 +819,12 @@ static int service_setup_bus_name(Service *s) {
|
||||
if (s->type == SERVICE_DBUS) {
|
||||
r = unit_add_dependency_by_name(UNIT(s), UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, true, UNIT_DEPENDENCY_FILE);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(UNIT(s), r, "Failed to add dependency on " SPECIAL_DBUS_SOCKET ": %m");
|
||||
return log_unit_error_errno(UNIT(s), r, "Failed to add dependency on %s: %m", SPECIAL_DBUS_SOCKET);
|
||||
|
||||
/* We always want to be ordered against dbus.socket if both are in the transaction. */
|
||||
r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, SPECIAL_DBUS_SOCKET, true, UNIT_DEPENDENCY_FILE);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(UNIT(s), r, "Failed to add dependency on " SPECIAL_DBUS_SOCKET ": %m");
|
||||
return log_unit_error_errno(UNIT(s), r, "Failed to add dependency on %s: %m", SPECIAL_DBUS_SOCKET);
|
||||
}
|
||||
|
||||
r = unit_watch_bus_name(UNIT(s), s->bus_name);
|
||||
|
||||
Reference in New Issue
Block a user