]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
execute: improve log message about TTY ownership reset failures
authorLennart Poettering <lennart@poettering.net>
Wed, 6 Dec 2023 15:38:53 +0000 (16:38 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 12 Dec 2023 15:06:08 +0000 (16:06 +0100)
src/core/execute.c

index 455d7e80132802b28d28d7468bedc8c071fa2a03..ef0bf88687411ed86ccb8a267a7294f94d034c42 100644 (file)
@@ -1466,7 +1466,7 @@ void exec_context_revert_tty(ExecContext *c) {
         if (!path)
                 return;
 
-        fd = open(path, O_PATH|O_CLOEXEC);
+        fd = open(path, O_PATH|O_CLOEXEC); /* Pin the inode */
         if (fd < 0)
                 return (void) log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, errno,
                                              "Failed to open TTY inode of '%s' to adjust ownership/access mode, ignoring: %m",
@@ -1485,7 +1485,7 @@ void exec_context_revert_tty(ExecContext *c) {
 
         r = fchmod_and_chown(fd, TTY_MODE, 0, TTY_GID);
         if (r < 0)
-                log_warning_errno(r, "Failed to reset TTY ownership/access mode of %s, ignoring: %m", path);
+                log_warning_errno(r, "Failed to reset TTY ownership/access mode of %s to " UID_FMT ":" GID_FMT ", ignoring: %m", path, (uid_t) 0, (gid_t) TTY_GID);
 }
 
 int exec_context_get_clean_directories(