summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorQC <qball@gmpclient.org>2014-03-16 13:47:44 +0100
committerQC <qball@gmpclient.org>2014-03-16 13:48:03 +0100
commitf033a0d6699bdc3115f2be704960df9193a5da7c (patch)
treec85bce72e52d5b009cd440315b028e3217f030b0 /source
parentdc5c853d91ab28b38d191cbb355c15c9f8d86e52 (diff)
Small fix.
Diffstat (limited to 'source')
-rw-r--r--source/profile-dialog.c5
-rw-r--r--source/rofi.c5
-rw-r--r--source/run-dialog.c5
3 files changed, 10 insertions, 5 deletions
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 <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;
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 ) {