From dc6cae46ca40ca1af04901faf73dac6003c70e61 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 28 Jan 2017 00:11:59 -0800 Subject: [PATCH] GUACAMOLE-94: Use readdir() instead of readdir_r(). Multiple threads will not be accessing the same directory stream. --- src/protocols/rdp/rdp_fs.c | 10 +++------- src/protocols/rdp/rdp_fs.h | 6 ------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/protocols/rdp/rdp_fs.c b/src/protocols/rdp/rdp_fs.c index 2909fea9..28019d8e 100644 --- a/src/protocols/rdp/rdp_fs.c +++ b/src/protocols/rdp/rdp_fs.c @@ -595,16 +595,12 @@ const char* guac_rdp_fs_read_dir(guac_rdp_fs* fs, int file_id) { return NULL; } - /* Read next entry, stop if error */ - if (readdir_r(file->dir, &(file->__dirent), &result)) - return NULL; - - /* If no more entries, return NULL */ - if (result == NULL) + /* Read next entry, stop if error or no more entries */ + if ((result = readdir(file->dir)) == NULL) return NULL; /* Return filename */ - return file->__dirent.d_name; + return result->d_name; } diff --git a/src/protocols/rdp/rdp_fs.h b/src/protocols/rdp/rdp_fs.h index 312679d1..abdda105 100644 --- a/src/protocols/rdp/rdp_fs.h +++ b/src/protocols/rdp/rdp_fs.h @@ -216,12 +216,6 @@ typedef struct guac_rdp_fs_file { */ DIR* dir; - /** - * The last read dirent structure. This is used if traversing the contents - * of a directory. - */ - struct dirent __dirent; - /** * The pattern the check directory contents against, if any. */