diff options
author | Kyungwook Tak <k.tak@samsung.com> | 2016-12-21 18:22:55 +0900 |
---|---|---|
committer | Kyungwook Tak <k.tak@samsung.com> | 2016-12-26 09:28:15 +0900 |
commit | eb3377ead579ea16045fb6c49f9fd6b26947cfc3 (patch) | |
tree | c4bd9cc2e252aafc8ff2fb0d33065f0485104a8c | |
parent | 859c4e6ee0e5a957ce4675918ad3b7a2fb82fbc9 (diff) | |
download | drm-service-core-tizen-submit/tizen/20170106.082921.tar.gz drm-service-core-tizen-submit/tizen/20170106.082921.tar.bz2 drm-service-core-tizen-submit/tizen/20170106.082921.zip |
Replace deprecated readdir_r with readdirsubmit/tizen/20170106.082921submit/tizen/20170106.082227submit/tizen/20161226.013211accepted/tizen/wearable/20161226.131219accepted/tizen/tv/20161226.131210accepted/tizen/mobile/20161226.131204accepted/tizen/ivi/20161226.131243accepted/tizen/common/20161227.192120
Change-Id: I47574d8c7523b5976e79adefa2a6cf290fe705db
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
-rw-r--r-- | tadcore/TADCInterface/TADC_IF.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tadcore/TADCInterface/TADC_IF.cpp b/tadcore/TADCInterface/TADC_IF.cpp index 6033592..2095ef7 100644 --- a/tadcore/TADCInterface/TADC_IF.cpp +++ b/tadcore/TADCInterface/TADC_IF.cpp @@ -36,6 +36,7 @@ #include <dirent.h> +#include <cerrno> #include <memory> #include "DUIDGenerator.h" @@ -338,9 +339,7 @@ int AddCertSTOREFromDir(X509_STORE *pstStore, const char *dirPath) int ret = 0; DIR *dir = NULL; - struct dirent entry; - struct dirent *result; - int error; + struct dirent *result = nullptr; char file_path_buff[512]; if (pstStore == NULL || dirPath == NULL) { @@ -358,23 +357,25 @@ int AddCertSTOREFromDir(X509_STORE *pstStore, const char *dirPath) } while (true) { - error = readdir_r(dir, &entry, &result); - - if (error != 0) { - DRM_TAPPS_EXCEPTION("fail to read entries from a directory(%s)!", dirPath); - ret = -1; - goto error; + errno = 0; + result = readdir(dir); + if (result == NULL) { + if (errno != 0) { + DRM_TAPPS_EXCEPTION("fail to read entries from a directory(%s)!", + dirPath); + ret = -1; + goto error; + } else { + // end of stream + break; + } } - // readdir_r returns NULL in *result if the end - // of the directory stream is reached - if (result == NULL) - break; - - if (entry.d_type == DT_REG) { // regular file + if (result->d_type == DT_REG) { + // regular file memset(file_path_buff, 0, sizeof(file_path_buff)); snprintf(file_path_buff, sizeof(file_path_buff), "%s/%s", dirPath, - entry.d_name); + result->d_name); if (AddCertSTOREFromFile(pstStore, file_path_buff) == 0) { DRM_TAPPS_LOG("Add root cert : file=%s", file_path_buff); |