Skip to content

Instantly share code, notes, and snippets.

@tsutsui
Created March 1, 2014 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsutsui/9285759 to your computer and use it in GitHub Desktop.
Save tsutsui/9285759 to your computer and use it in GitHub Desktop.
mlterm-fb patch for non-priviileged user to use mlterm-fb on NetBSD/x68k
--- mlterm-3.3.3/fb/xwindow/fb/x_display_x68kgrf.c.orig 2014-02-28 20:16:03.000000000 +0900
+++ mlterm-3.3.3/fb/xwindow/fb/x_display_x68kgrf.c 2014-03-01 13:41:03.000000000 +0900
@@ -185,8 +185,15 @@ open_display(
struct rgb_info rgb_info_15bpp = { 3 , 3 , 3 , 6 , 11 , 1 } ;
struct termios tm ;
- if( ( _display.fb_fd = open( ( dev = getenv("FRAMEBUFFER")) ? dev : "/dev/grf1" ,
- O_RDWR)) < 0)
+ kik_priv_restore_euid() ;
+ kik_priv_restore_egid() ;
+
+ _display.fb_fd = open( ( dev = getenv("FRAMEBUFFER")) ? dev : "/dev/grf1" , O_RDWR);
+
+ kik_priv_change_euid( kik_getuid()) ;
+ kik_priv_change_egid( kik_getgid()) ;
+
+ if( _display.fb_fd < 0)
{
kik_msg_printf( "Couldn't open %s.\n" , dev ? dev : "/dev/grf1") ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment