]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
terminal-session: Drop unnecessary grantpt() call.
authorZhao Qiang <zhaoqiangx@gmail.com>
Fri, 6 Mar 2020 17:43:03 +0000 (01:43 +0800)
committerZhao Qiang <zhaoqiangx@gmail.com>
Fri, 6 Mar 2020 17:49:17 +0000 (01:49 +0800)
plymouth calls `grantpt()` when setting up the pseudoterminal it uses
for boot logging and console broadcasting. `grantpt()` traditionally
sets up the access permissions and file mode of the created slave
pseudoterminal device node.

That call is unnecessary for two reasons:
1. The kernel automatically sets up the correct permissions at open
   time on modern Linux.
2. plymouthd runs as root anyway

Furthermore, it seems like, for some unknown reason, the call may be
interfering with the shutdown process.

This commit drops the call, since it's unnecessary, and potentially
even problematic.

src/libply/ply-terminal-session.c

index c139349fae873ae1ed30166a749201b21e98222e..cacd3650b3b302f1d804d401afd9ad1e2fb6d88b 100644 (file)
@@ -183,16 +183,6 @@ open_pseudoterminal (ply_terminal_session_t *session)
 
         ply_trace (" opened device '/dev/ptmx'");
 
-        ply_trace ("creating pseudoterminal");
-        if (grantpt (session->pseudoterminal_master_fd) < 0) {
-                ply_save_errno ();
-                ply_trace ("could not create psuedoterminal: %m");
-                close_pseudoterminal (session);
-                ply_restore_errno ();
-                return false;
-        }
-        ply_trace ("done creating pseudoterminal");
-
         ply_trace ("unlocking pseudoterminal");
         if (unlockpt (session->pseudoterminal_master_fd) < 0) {
                 ply_save_errno ();