Small fix.

This commit is contained in:
QC 2014-03-16 13:47:44 +01:00
parent dc5c853d91
commit f033a0d669
3 changed files with 10 additions and 5 deletions

View File

@ -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 ) {

View File

@ -39,6 +39,7 @@
#include <fcntl.h>
#include <err.h>
#include <errno.h>
#include <time.h>
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
@ -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;

View File

@ -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 ) {