condition: reverse if check to lower indentation level
No change in behaviour. Let's just prefer early exit over deeper indentation.
This commit is contained in:
parent
f8b4ae29c7
commit
ce0f7f5546
|
@ -602,29 +602,27 @@ static int condition_test_needs_update(Condition *c, char **env) {
|
||||||
* AND the target file's nanoseconds == 0
|
* AND the target file's nanoseconds == 0
|
||||||
* (otherwise the filesystem supports nsec timestamps, see stat(2)).
|
* (otherwise the filesystem supports nsec timestamps, see stat(2)).
|
||||||
*/
|
*/
|
||||||
if (usr.st_mtim.tv_nsec > 0 && other.st_mtim.tv_nsec == 0) {
|
if (usr.st_mtim.tv_nsec == 0 || other.st_mtim.tv_nsec > 0)
|
||||||
_cleanup_free_ char *timestamp_str = NULL;
|
return usr.st_mtim.tv_nsec > other.st_mtim.tv_nsec;
|
||||||
uint64_t timestamp;
|
|
||||||
|
|
||||||
r = parse_env_file(NULL, p, "TIMESTAMP_NSEC", ×tamp_str);
|
_cleanup_free_ char *timestamp_str = NULL;
|
||||||
if (r < 0) {
|
r = parse_env_file(NULL, p, "TIMESTAMP_NSEC", ×tamp_str);
|
||||||
log_debug_errno(r, "Failed to parse timestamp file '%s', using mtime: %m", p);
|
if (r < 0) {
|
||||||
return true;
|
log_debug_errno(r, "Failed to parse timestamp file '%s', using mtime: %m", p);
|
||||||
} else if (r == 0) {
|
return true;
|
||||||
log_debug("No data in timestamp file '%s', using mtime.", p);
|
} else if (r == 0) {
|
||||||
return true;
|
log_debug("No data in timestamp file '%s', using mtime.", p);
|
||||||
}
|
return true;
|
||||||
|
|
||||||
r = safe_atou64(timestamp_str, ×tamp);
|
|
||||||
if (r < 0) {
|
|
||||||
log_debug_errno(r, "Failed to parse timestamp value '%s' in file '%s', using mtime: %m", timestamp_str, p);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return timespec_load_nsec(&usr.st_mtim) > timestamp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return usr.st_mtim.tv_nsec > other.st_mtim.tv_nsec;
|
uint64_t timestamp;
|
||||||
|
r = safe_atou64(timestamp_str, ×tamp);
|
||||||
|
if (r < 0) {
|
||||||
|
log_debug_errno(r, "Failed to parse timestamp value '%s' in file '%s', using mtime: %m", timestamp_str, p);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return timespec_load_nsec(&usr.st_mtim) > timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int condition_test_first_boot(Condition *c, char **env) {
|
static int condition_test_first_boot(Condition *c, char **env) {
|
||||||
|
|
Loading…
Reference in a new issue