diff --git a/source/profile-dialog.c b/source/profile-dialog.c index 6ca2e4a3..824b52a4 100644 --- a/source/profile-dialog.c +++ b/source/profile-dialog.c @@ -81,8 +81,9 @@ static char ** get_profile ( ) if ( getenv( "HOME" ) == NULL ) return NULL; const char *hd = getenv( "HOME" ); - path = allocate( strlen( hd ) + strlen( ".switch_profile.conf" )+3 ); - sprintf( path, "%s/%s", hd, ".switch_profile.conf" ); + unsigned int path_length = strlen( hd ) + strlen( ".switch_profile.conf" )+3; + path = allocate( path_length ); + snprintf( path, path_length, "%s/%s", hd, ".switch_profile.conf" ); FILE *fd = fopen ( path, "r" ); if ( fd != NULL ) { diff --git a/source/rofi.c b/source/rofi.c index a6b0317f..f313d7f3 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -432,7 +433,9 @@ int take_keyboard( Window w ) if ( XGrabKeyboard( display, w, True, GrabModeAsync, GrabModeAsync, CurrentTime ) == GrabSuccess ) return 1; - usleep( 1000 ); + + struct timespec rsl = { 1, 0L }; + nanosleep(&rsl, NULL); } return 0; diff --git a/source/run-dialog.c b/source/run-dialog.c index 20419b94..1a728739 100644 --- a/source/run-dialog.c +++ b/source/run-dialog.c @@ -88,8 +88,9 @@ static pid_t exec_cmd( const char *cmd, int run_in_term ) * This happens in non-critical time (After launching app) * It is allowed to be a bit slower. */ - char *path = allocate( strlen( cache_dir ) + strlen( RUN_CACHE_FILE )+3 ); - sprintf( path, "%s/%s", cache_dir, RUN_CACHE_FILE ); + size_t path_length = strlen( cache_dir ) + strlen( RUN_CACHE_FILE )+3; + char *path = allocate( path_length ); + snprintf( path, path_length, "%s/%s", cache_dir, RUN_CACHE_FILE ); FILE *fd = fopen ( path, "r" ); if ( fd != NULL ) {