@ -211,8 +211,10 @@ setup_tty(struct launcher_direct *launcher, int tty)
loop = wl_display_get_event_loop ( launcher - > compositor - > wl_display ) ;
loop = wl_display_get_event_loop ( launcher - > compositor - > wl_display ) ;
launcher - > vt_source =
launcher - > vt_source =
wl_event_loop_add_signal ( loop , SIGRTMIN , vt_handler , launcher ) ;
wl_event_loop_add_signal ( loop , SIGRTMIN , vt_handler , launcher ) ;
if ( ! launcher - > vt_source )
if ( ! launcher - > vt_source ) {
weston_log ( " failed to add SIGRTMIN signal \n " ) ;
goto err_close ;
goto err_close ;
}
return 0 ;
return 0 ;
@ -229,8 +231,10 @@ launcher_direct_open(struct weston_launcher *launcher_base, const char *path, in
int fd ;
int fd ;
fd = open ( path , flags | O_CLOEXEC ) ;
fd = open ( path , flags | O_CLOEXEC ) ;
if ( fd = = - 1 )
if ( fd = = - 1 ) {
weston_log ( " couldn't open: %s! error=%s \n " , path , strerror ( errno ) ) ;
return - 1 ;
return - 1 ;
}
if ( geteuid ( ) ! = 0 ) {
if ( geteuid ( ) ! = 0 ) {
weston_log ( " WARNING! Succeeded opening %s as non-root user. "
weston_log ( " WARNING! Succeeded opening %s as non-root user. "
@ -239,6 +243,7 @@ launcher_direct_open(struct weston_launcher *launcher_base, const char *path, in
}
}
if ( fstat ( fd , & s ) = = - 1 ) {
if ( fstat ( fd , & s ) = = - 1 ) {
weston_log ( " couldn't fstat: %s! error=%s \n " , path , strerror ( errno ) ) ;
close ( fd ) ;
close ( fd ) ;
return - 1 ;
return - 1 ;
}
}
@ -283,7 +288,8 @@ launcher_direct_restore(struct weston_launcher *launcher_base)
mode . mode = VT_AUTO ;
mode . mode = VT_AUTO ;
if ( ioctl ( launcher - > tty , VT_SETMODE , & mode ) < 0 )
if ( ioctl ( launcher - > tty , VT_SETMODE , & mode ) < 0 )
weston_log ( " could not reset vt handling \n " ) ;
weston_log ( " could not reset vt handling! error=%s \n " ,
strerror ( errno ) ) ;
}
}
static int
static int
@ -300,8 +306,10 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
struct launcher_direct * launcher ;
struct launcher_direct * launcher ;
launcher = zalloc ( sizeof ( * launcher ) ) ;
launcher = zalloc ( sizeof ( * launcher ) ) ;
if ( launcher = = NULL )
if ( launcher = = NULL ) {
weston_log ( " failed to alloc for launcher \n " ) ;
return - ENOMEM ;
return - ENOMEM ;
}
launcher - > base . iface = & launcher_direct_iface ;
launcher - > base . iface = & launcher_direct_iface ;
launcher - > compositor = compositor ;
launcher - > compositor = compositor ;
@ -338,13 +346,16 @@ launcher_direct_get_vt(struct weston_launcher *base)
{
{
struct launcher_direct * launcher = wl_container_of ( base , launcher , base ) ;
struct launcher_direct * launcher = wl_container_of ( base , launcher , base ) ;
struct stat s ;
struct stat s ;
if ( fstat ( launcher - > tty , & s ) < 0 )
if ( fstat ( launcher - > tty , & s ) < 0 ) {
weston_log ( " couldn't fstat launcher tty: %s \n " , strerror ( errno ) ) ;
return - 1 ;
return - 1 ;
}
return minor ( s . st_rdev ) ;
return minor ( s . st_rdev ) ;
}
}
const struct launcher_interface launcher_direct_iface = {
const struct launcher_interface launcher_direct_iface = {
. name = " direct " ,
. connect = launcher_direct_connect ,
. connect = launcher_direct_connect ,
. destroy = launcher_direct_destroy ,
. destroy = launcher_direct_destroy ,
. open = launcher_direct_open ,
. open = launcher_direct_open ,