summarylogtreecommitdiffstats
path: root/tty_default_permissions.patch
blob: f72fc365e2c494db8c080e35c61823199c048e3d (plain)
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
34
35
36
37
38
39
40
41
42
43
44
*** trueportd.c.orig	2016-12-02 14:09:01.383822650 -0500
--- trueportd.c	2016-12-02 14:10:46.453902417 -0500
***************
*** 1285,1301 ****
  	{
  		// if the device nodes do not exist, then create them
  		if( lstat( slave_ttyname, &stat_buf ) < 0 )
  		{
  			trace( tl_status, "Creating slave device node: %s \n", slave_ttyname );
! 			sprintf( buf, "mknod %s c %d %d", slave_ttyname, PTYX_SLAVE_MAJOR, minor_number );
  			if( system( buf ) == -1 ) 
  			{
  				trace( tl_error, "Could not create slave device node: %s\n", slave_ttyname  );
  				trace( tl_error, "  - %s\n", strerror( errno ) );
  				exit(-1);
  			}
  		}
  
  		if( lstat( master_ttyname, &stat_buf ) < 0 )
  		{
  			trace( tl_status, "Creating master device node: %s \n", master_ttyname );
--- 1285,1306 ----
  	{
  		// if the device nodes do not exist, then create them
  		if( lstat( slave_ttyname, &stat_buf ) < 0 )
  		{
  			trace( tl_status, "Creating slave device node: %s \n", slave_ttyname );
! 			sprintf( buf, "mknod -m@TRUEPORT_TTY_PERMISSIONS@ %s c %d %d", slave_ttyname, PTYX_SLAVE_MAJOR, minor_number );
  			if( system( buf ) == -1 ) 
  			{
  				trace( tl_error, "Could not create slave device node: %s\n", slave_ttyname  );
  				trace( tl_error, "  - %s\n", strerror( errno ) );
  				exit(-1);
  			}
+ #include <grp.h>
+ {
+   struct group *g=getgrnam("uucp");
+   if (g) chown(slave_ttyname,-1,g->gr_gid);
+ }
  		}
  
  		if( lstat( master_ttyname, &stat_buf ) < 0 )
  		{
  			trace( tl_status, "Creating master device node: %s \n", master_ttyname );