diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index b5b2b71b5..5f13d503d 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -101,7 +101,7 @@ BOOL xf_event_action_script_init(xfContext* xfc) actionScript = popen(command, "r"); - if (actionScript <= 0) + if (!actionScript) return FALSE; while (fgets(buffer, sizeof(buffer), actionScript)) @@ -170,7 +170,7 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, XEvent* event) actionScript = popen(command, "r"); - if (actionScript < 0) + if (!actionScript) return FALSE; while (fgets(buffer, sizeof(buffer), actionScript)) diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index 963055639..a85186f8a 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -72,7 +72,7 @@ BOOL xf_keyboard_action_script_init(xfContext* xfc) keyScript = popen(command, "r"); - if (keyScript < 0) + if (!keyScript) { free(xfc->actionScript); xfc->actionScript = NULL; @@ -414,7 +414,7 @@ int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* mod, Key keyScript = popen(command, "r"); - if (keyScript < 0) + if (!keyScript) return -1; while (fgets(buffer, sizeof(buffer), keyScript) != NULL) diff --git a/libfreerdp/locale/keyboard_sun.c b/libfreerdp/locale/keyboard_sun.c index 5f8b62e17..111abf7bd 100644 --- a/libfreerdp/locale/keyboard_sun.c +++ b/libfreerdp/locale/keyboard_sun.c @@ -227,7 +227,7 @@ int freerdp_get_solaris_keyboard_layout_and_type(int* type, int* layout) kbd = popen("kbd -t -l", "r"); - if (kbd < 0) + if (!kbd) return -1; while (fgets(buffer, sizeof(buffer), kbd) != NULL) diff --git a/libfreerdp/locale/keyboard_x11.c b/libfreerdp/locale/keyboard_x11.c index 387644d1b..e9ca41f2a 100644 --- a/libfreerdp/locale/keyboard_x11.c +++ b/libfreerdp/locale/keyboard_x11.c @@ -48,7 +48,8 @@ int freerdp_detect_keyboard_layout_from_xkb(DWORD* keyboardLayoutId) /* We start by looking for _XKB_RULES_NAMES_BACKUP which appears to be used by libxklavier */ - xprop = popen("xprop -root _XKB_RULES_NAMES_BACKUP", "r"); + if (!(xprop = popen("xprop -root _XKB_RULES_NAMES_BACKUP", "r"))) + return 0; /* Sample output for "Canadian Multilingual Standard" * @@ -100,7 +101,8 @@ int freerdp_detect_keyboard_layout_from_xkb(DWORD* keyboardLayoutId) /* Check _XKB_RULES_NAMES if _XKB_RULES_NAMES_BACKUP fails */ - xprop = popen("xprop -root _XKB_RULES_NAMES", "r"); + if (!(xprop = popen("xprop -root _XKB_RULES_NAMES", "r"))) + return 0; while (fgets(buffer, sizeof(buffer), xprop) != NULL) { @@ -157,6 +159,9 @@ char* freerdp_detect_keymap_from_xkb() /* this tells us about the current XKB configuration, if XKB is available */ setxkbmap = popen("setxkbmap -print", "r"); + if (!setxkbmap) + return NULL; + while (fgets(buffer, sizeof(buffer), setxkbmap) != NULL) { /* the line with xkb_keycodes is what interests us */