mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
Merge pull request #32738 from yuwata/trivial-cleanups
Trivial follow-ups for recent changes
This commit is contained in:
@@ -259,7 +259,7 @@ int mkdir_p_root_full(const char *root, const char *p, uid_t uid, gid_t gid, mod
|
||||
struct timespec tspec;
|
||||
timespec_store(&tspec, ts);
|
||||
|
||||
if (futimens(dfd, (const struct timespec[2]) { { .tv_nsec = UTIME_OMIT }, tspec }) < 0)
|
||||
if (futimens(dfd, (const struct timespec[2]) { TIMESPEC_OMIT, tspec }) < 0)
|
||||
return -errno;
|
||||
|
||||
if (futimens(nfd, (const struct timespec[2]) { tspec, tspec }) < 0)
|
||||
|
||||
@@ -75,6 +75,8 @@ typedef enum TimestampStyle {
|
||||
#define DUAL_TIMESTAMP_INFINITY ((dual_timestamp) { USEC_INFINITY, USEC_INFINITY })
|
||||
#define TRIPLE_TIMESTAMP_NULL ((triple_timestamp) {})
|
||||
|
||||
#define TIMESPEC_OMIT ((const struct timespec) { .tv_nsec = UTIME_OMIT })
|
||||
|
||||
usec_t now(clockid_t clock);
|
||||
nsec_t now_nsec(clockid_t clock);
|
||||
|
||||
|
||||
@@ -2441,11 +2441,9 @@ static void service_enter_start(Service *s) {
|
||||
return service_set_state(s, SERVICE_START);
|
||||
|
||||
default:
|
||||
;
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
assert_not_reached();
|
||||
|
||||
fail:
|
||||
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
||||
}
|
||||
|
||||
@@ -1311,27 +1311,26 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
|
||||
* is run first. */
|
||||
|
||||
if (c->log_namespace) {
|
||||
FOREACH_STRING(s, "systemd-journald", "systemd-journald-varlink") {
|
||||
_cleanup_free_ char *socket_unit = NULL;
|
||||
static const struct {
|
||||
const char *template;
|
||||
UnitType type;
|
||||
} deps[] = {
|
||||
{ "systemd-journald", UNIT_SOCKET, },
|
||||
{ "systemd-journald-varlink", UNIT_SOCKET, },
|
||||
{ "systemd-journald-sync", UNIT_SERVICE, },
|
||||
};
|
||||
|
||||
r = unit_name_build_from_type(s, c->log_namespace, UNIT_SOCKET, &socket_unit);
|
||||
FOREACH_ELEMENT(i, deps) {
|
||||
_cleanup_free_ char *unit = NULL;
|
||||
|
||||
r = unit_name_build_from_type(i->template, c->log_namespace, i->type, &unit);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, socket_unit, true, UNIT_DEPENDENCY_FILE);
|
||||
r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, unit, true, UNIT_DEPENDENCY_FILE);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
_cleanup_free_ char *sync_unit = NULL;
|
||||
|
||||
r = unit_name_build_from_type("systemd-journald-sync", c->log_namespace, UNIT_SERVICE, &sync_unit);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, sync_unit, true, UNIT_DEPENDENCY_FILE);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else {
|
||||
r = unit_add_dependency_by_name(u, UNIT_AFTER, SPECIAL_JOURNALD_SOCKET, true, UNIT_DEPENDENCY_FILE);
|
||||
if (r < 0)
|
||||
|
||||
@@ -4936,7 +4936,7 @@ static int do_copy_files(Context *context, Partition *p, const char *root) {
|
||||
struct timespec tspec;
|
||||
timespec_store(&tspec, ts);
|
||||
|
||||
if (futimens(pfd, (const struct timespec[2]) { { .tv_nsec = UTIME_OMIT }, tspec }) < 0)
|
||||
if (futimens(pfd, (const struct timespec[2]) { TIMESPEC_OMIT, tspec }) < 0)
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user