source: fix readdir_r bug 87/63387/1
authorJinhyung Choi <jinh0.choi@samsung.com>
Wed, 23 Mar 2016 11:28:41 +0000 (20:28 +0900)
committerJinhyung Choi <jinh0.choi@samsung.com>
Wed, 23 Mar 2016 11:28:41 +0000 (20:28 +0900)
Change-Id: I57bedffa51aa353c88c6e960dcd1a219fa903d30
Signed-off-by: Jinhyung Choi <jinh0.choi@samsung.com>
src/device_manager_plugin_emul.c

index c99a455..137cd39 100644 (file)
@@ -256,7 +256,7 @@ static int OEM_sys_display_info(struct display_info *disp_info)
        index = 0;
        dirp = opendir(bl_path);
        if (dirp) {
-               while (!readdir_r(dirp, &entry, &dent)) {
+               while (!readdir_r(dirp, &entry, &dent) && dent) {
                        if (index >= DISP_MAX) {
                                devmgr_log("supports %d display node", DISP_MAX);
                                break;
@@ -279,7 +279,7 @@ static int OEM_sys_display_info(struct display_info *disp_info)
        index = 0;
        dirp = opendir(lcd_path);
        if (dirp) {
-               while (!readdir_r(dirp, &entry, &dent)) {
+               while (!readdir_r(dirp, &entry, &dent) && dent) {
                        if (index >= DISP_MAX) {
                                devmgr_log("supports %d display node", DISP_MAX);
                                break;