various: do not include file names directly in error messages

git grep -l 'Failed to open /'|xargs sed -r -i 's|"Failed to open (/[^ ]+): %m"|"Failed to open %s: %m", "\1"|g'
git grep -l $'Failed to open \'/'|xargs sed -r -i $'s|"Failed to open \'(/[^ ]+)\': %m"|"Failed to open %s: %m", "\\1"|g'
git grep -l "Failed to open /"|xargs sed -r -i $'s|"Failed to open (/[^ ]+), ignoring: %m"|"Failed to open %s, ignoring: %m", "\\1"|g'
+ some manual fixups.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-06-02 11:10:38 +02:00
parent 3f1812180b
commit 42ba99748d
37 changed files with 55 additions and 55 deletions
+1 -1
View File
@@ -344,7 +344,7 @@ static int open_dev_autofs(Manager *m) {
m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY);
if (m->dev_autofs_fd < 0)
return log_error_errno(errno, "Failed to open /dev/autofs: %m");
return log_error_errno(errno, "Failed to open %s: %m", "/dev/autofs");
init_autofs_dev_ioctl(&param);
r = RET_NERRNO(ioctl(m->dev_autofs_fd, AUTOFS_DEV_IOCTL_VERSION, &param));
+1 -1
View File
@@ -626,7 +626,7 @@ static int import_credentials_initrd(ImportCredentialContext *c) {
if (errno == ENOENT)
log_debug_errno(errno, "No credentials passed from initrd.");
else
log_warning_errno(errno, "Failed to open '/run/credentials/@initrd', ignoring: %m");
log_warning_errno(errno, "Failed to open '%s', ignoring: %m", "/run/credentials/@initrd");
return 0;
}
+1 -1
View File
@@ -245,7 +245,7 @@ static int console_setup(void) {
tty_fd = open_terminal("/dev/console", O_RDWR|O_NOCTTY|O_CLOEXEC);
if (tty_fd < 0)
return log_error_errno(tty_fd, "Failed to open /dev/console: %m");
return log_error_errno(tty_fd, "Failed to open %s: %m", "/dev/console");
/* We don't want to force text mode. Plymouth may be showing pictures already from initrd. */
reset_dev_console_fd(tty_fd, /* switch_to_text= */ false);
+1 -1
View File
@@ -497,7 +497,7 @@ static int manager_enable_special_signals(Manager *m) {
fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC);
if (fd < 0)
/* Support systems without virtual console (ENOENT) gracefully */
log_full_errno(fd == -ENOENT ? LOG_DEBUG : LOG_WARNING, fd, "Failed to open /dev/tty0, ignoring: %m");
log_full_errno(fd == -ENOENT ? LOG_DEBUG : LOG_WARNING, fd, "Failed to open %s, ignoring: %m", "/dev/tty0");
else {
/* Enable that we get SIGWINCH on kbrequest */
if (ioctl(fd, KDSIGACCEPT, SIGWINCH) < 0)
+1 -1
View File
@@ -2264,7 +2264,7 @@ static int apply_mounts(
if (reterr_path)
*reterr_path = strdup("/proc/self/mountinfo");
return log_debug_errno(r, "Failed to open /proc/self/mountinfo: %m");
return log_debug_errno(r, "Failed to open %s: %m", "/proc/self/mountinfo");
}
/* First round, establish all mounts we need */
+1 -1
View File
@@ -1317,7 +1317,7 @@ static void swap_enumerate(Manager *m) {
if (errno == ENOENT)
log_debug_errno(errno, "Not swap enabled, skipping enumeration.");
else
log_warning_errno(errno, "Failed to open /proc/swaps, ignoring: %m");
log_warning_errno(errno, "Failed to open %s, ignoring: %m", "/proc/swaps");
return;
}