Skip to content

Commit 22bc218

Browse files
committed
Fix #462: /dev/pts mounted with wrong mode
Before this fix: admin@infix:~$ sudo ls -la /dev/pts/ total 0 drwxr-xr-x 2 root root 0 Dec 24 08:16 . drwxr-xr-x 13 root root 13340 Dec 24 08:16 .. cr-------- 1 root tty 136, 0 Dec 24 08:18 0 crw-rw-rw- 1 root root 5, 2 Dec 24 08:16 ptmx admin@infix:~$ mount | grep devpts devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=400,ptmxmode=666) After: admin@infix-00-00-00:~$ sudo ls -l /dev/pts/ total 0 crw--w---- 1 root tty 136, 0 Dec 24 08:21 0 crw-rw-rw- 1 root root 5, 2 Dec 24 08:20 ptmx admin@infix-00-00-00:~$ mount |grep pts devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666) Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 702a606 commit 22bc218

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/finit.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,14 @@ static void fs_finalize(void)
371371
/* Modern systems use /dev/pts */
372372
if (!fismnt("/dev/pts")) {
373373
char opts[32];
374-
int mode;
375374
int gid;
376375

377376
gid = getgroup("tty");
378377
if (gid == -1)
379378
gid = 0;
380379

381380
/* 0600 is default on Debian, use 0620 to get mesg y by default */
382-
mode = 0620;
383-
snprintf(opts, sizeof(opts), "gid=%d,mode=%d,ptmxmode=0666", gid, mode);
381+
snprintf(opts, sizeof(opts), "gid=%d,mode=0620,ptmxmode=0666", gid);
384382

385383
makedir("/dev/pts", 0755);
386384
fs_mount("devpts", "/dev/pts", "devpts", flags, opts);

0 commit comments

Comments
 (0)