fix potential fd leak

In most cases, checking fd > 0 is not valid. open(2) returns -1 on
error, 0 on stdin, 1 on stdout, 2 on stderr, >2 . The border should be
between -1 and 0. Additionally, between 2 and 3.

Pointed out by: #919
This commit is contained in:
Koichiro IWAO
2018-01-13 22:10:48 +09:00
parent 5daa09171e
commit b17c45d86f
3 changed files with 4 additions and 6 deletions
+1 -1
View File
@@ -265,7 +265,7 @@ xrdp_load_keyboard_layout(struct xrdp_client_info *client_info)
fd = g_file_open(keyboard_cfg_file);
if (fd > 0)
if (fd >= 0)
{
int section_found = -1;
char section_rdp_layouts[256] = { 0 };