GUACAMOLE-94: Use readdir() instead of readdir_r(). Multiple threads will not be accessing the same directory stream.

This commit is contained in:
Michael Jumper 2017-01-28 00:11:59 -08:00
parent ea6b094e24
commit dc6cae46ca
2 changed files with 3 additions and 13 deletions

View File

@ -595,16 +595,12 @@ const char* guac_rdp_fs_read_dir(guac_rdp_fs* fs, int file_id) {
return NULL; return NULL;
} }
/* Read next entry, stop if error */ /* Read next entry, stop if error or no more entries */
if (readdir_r(file->dir, &(file->__dirent), &result)) if ((result = readdir(file->dir)) == NULL)
return NULL;
/* If no more entries, return NULL */
if (result == NULL)
return NULL; return NULL;
/* Return filename */ /* Return filename */
return file->__dirent.d_name; return result->d_name;
} }

View File

@ -216,12 +216,6 @@ typedef struct guac_rdp_fs_file {
*/ */
DIR* dir; 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. * The pattern the check directory contents against, if any.
*/ */