File: 204967-resetpermissions.patch

package info (click to toggle)
mingetty 1.08-2
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch, wheezy
  • size: 212 kB
  • ctags: 202
  • sloc: ansic: 2,552; makefile: 16
file content (33 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: Reset permissions on /dev/vcsN and /dev/vcsaN on logout.
Author: Hamish Moffatt <hamish@debian.org>
Author: Paul Martin <pm@debian.org>
Bug-Debian: http://bugs.debian.org/13509
Bug-Debian: http://bugs.debian.org/204967
Last-Update: 2003-08-19

Index: mingetty-1.08/mingetty.c
===================================================================
--- mingetty-1.08.orig/mingetty.c	2012-05-01 12:29:57.598626744 +0100
+++ mingetty-1.08/mingetty.c	2012-05-01 12:34:56.088097009 +0100
@@ -137,6 +137,21 @@
 	char buf[40];
 	int fd;
 
+	/* Reset permissions on the console device */
+	if ((strncmp(tty, "tty", 3) == 0) && (isdigit(tty[3]))) {
+		strcpy (buf, "/dev/vcs");
+		strcat (buf, &tty[3]);
+		if (chown (buf, 0, 3) || chmod (buf, 0600))
+			if (errno != ENOENT)
+				error ("%s: %s", buf, strerror(errno));
+
+		strcpy (buf, "/dev/vcsa");
+		strcat (buf, &tty[3]);
+		if (chown (buf, 0, 3) || chmod (buf, 0600))
+			if (errno != ENOENT)
+				error ("%s: %s", buf, strerror(errno));
+	}
+
 	/* Set up new standard input. */
 	if (tty[0] == '/') {
 		strncpy (buf, tty, sizeof(buf)-1);