commit 96ce860

hovercats  ·  2024-04-15 12:56:01 +0000 UTC
parent bfc0abc
ubase: fix permission issues with /dev/tty*
3 files changed,  +29, -1
+1, -0
1@@ -113,6 +113,7 @@
2 [submodule "pkg/ubase/src"]
3 	path = pkg/ubase/src
4 	url = https://github.com/michaelforney/ubase
5+	ignore = all
6 [submodule "pkg/util-linux/src"]
7 	path = pkg/util-linux/src
8 	url = https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
+27, -0
 1@@ -0,0 +1,27 @@
 2+From 4f0bcda44064d3f11f6f795b60b6dbf02537c2a6 Mon Sep 17 00:00:00 2001
 3+From: hovercats <hovercatswithlasereyes@protonmail.com>
 4+Date: Sun, 14 Apr 2024 23:45:12 +0200
 5+Subject: [PATCH] login: fix permissions for /dev/tty*
 6+
 7+upon logging in, /dev/ttyN should change ownership to $USER.
 8+This did not occour, which made rc unable to run inside a tty unless ran as root.
 9+---
10+ login.c | 2 ++
11+ 1 file changed, 2 insertions(+)
12+
13+diff --git a/login.c b/login.c
14+index 25a59e4..a4aaaf6 100644
15+--- a/login.c
16++++ b/login.c
17+@@ -116,6 +116,8 @@ main(int argc, char *argv[])
18+ 	tty = ttyname(0);
19+ 	if (!tty)
20+ 		eprintf("ttyname:");
21++	if (fchown(0, uid, gid) < 0)
22++		eprintf("fchown:");
23+ 
24+ 	writeutmp(user, tty);
25+ 
26+-- 
27+2.44.0
28+
+1, -1
1@@ -1 +1 @@
2-f152e7fc3b r0
3+f152e7fc3b r1