client/locale: properly check popen return value
popen returns NULL if an error occurs and not < 0.
This commit is contained in:
parent
19afc6906c
commit
421b74e85e
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user