mirror of
https://github.com/systemd/systemd
synced 2024-10-15 04:24:19 +00:00
debug-generator: don't eat up error if we can't write drop-in
While at it, prepend the drop-in text with our usual "Automatically generated by ...".
This commit is contained in:
parent
2997df9777
commit
a3816ea427
|
@ -141,22 +141,25 @@ static int generate_wants_symlinks(void) {
|
|||
return r;
|
||||
}
|
||||
|
||||
static void install_debug_shell_dropin(void) {
|
||||
static int install_debug_shell_dropin(void) {
|
||||
const char *tty = arg_debug_tty ?: arg_default_debug_tty;
|
||||
int r;
|
||||
|
||||
if (!tty || path_equal(tty, skip_dev_prefix(DEBUGTTY)))
|
||||
return;
|
||||
return 0;
|
||||
|
||||
r = write_drop_in_format(arg_dest, "debug-shell.service", 50, "tty",
|
||||
"# Automatically generated by systemd-debug-generator\n\n"
|
||||
"[Unit]\n"
|
||||
"Description=Early root shell on /dev/%s FOR DEBUGGING ONLY\n"
|
||||
"ConditionPathExists=\n"
|
||||
"[Service]\n"
|
||||
"TTYPath=/dev/%s",
|
||||
"\n[Service]\n"
|
||||
"TTYPath=/dev/%s\n",
|
||||
tty, tty);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to write drop-in for debug-shell.service, ignoring: %m");
|
||||
return log_warning_errno(r, "Failed to write drop-in for debug-shell.service: %m");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int process_unit_credentials(const char *credentials_dir) {
|
||||
|
@ -226,7 +229,7 @@ static int process_unit_credentials(const char *credentials_dir) {
|
|||
|
||||
static int run(const char *dest, const char *dest_early, const char *dest_late) {
|
||||
const char *credentials_dir;
|
||||
int r = 0;
|
||||
int r;
|
||||
|
||||
assert_se(arg_dest = dest_early);
|
||||
|
||||
|
@ -238,7 +241,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
|
|||
if (strv_extend(&arg_wants, "debug-shell.service") < 0)
|
||||
return log_oom();
|
||||
|
||||
install_debug_shell_dropin();
|
||||
RET_GATHER(r, install_debug_shell_dropin());
|
||||
}
|
||||
|
||||
if (get_credentials_dir(&credentials_dir) >= 0)
|
||||
|
|
Loading…
Reference in a new issue