1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-08 08:58:27 +03:00

system-update-generator: drop pointless goto

This commit is contained in:
David Tardon 2023-05-16 07:39:32 +02:00 committed by Yu Watanabe
parent 290c4a4b34
commit 6de77384e0

View File

@ -19,27 +19,25 @@
static const char *arg_dest = NULL;
static int generate_symlink(void) {
_cleanup_free_ char *j = NULL;
FOREACH_STRING(p, "/system-update", "/etc/system-update") {
if (laccess(p, F_OK) >= 0)
goto link_found;
if (laccess(p, F_OK) >= 0) {
_cleanup_free_ char *j = NULL;
j = path_join(arg_dest, SPECIAL_DEFAULT_TARGET);
if (!j)
return log_oom();
if (symlink(SYSTEM_DATA_UNIT_DIR "/system-update.target", j) < 0)
return log_error_errno(errno, "Failed to create symlink %s: %m", j);
return 1;
}
if (errno != ENOENT)
log_warning_errno(errno, "Failed to check if %s symlink exists, ignoring: %m", p);
}
return 0;
link_found:
j = path_join(arg_dest, SPECIAL_DEFAULT_TARGET);
if (!j)
return log_oom();
if (symlink(SYSTEM_DATA_UNIT_DIR "/system-update.target", j) < 0)
return log_error_errno(errno, "Failed to create symlink %s: %m", j);
return 1;
}
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {