- int ret = 0;
-
- DIR *dir = NULL;
- struct dirent entry;
- struct dirent *result;
- int error;
- char file_path_buff[512];
-
- if (pstStore == NULL || dirPath == NULL)
- {
- DRM_TAPPS_EXCEPTION("AddCertSTOREFromDir Error : Parameter error!");
- ret = -1;
- goto error;
- }
-
- dir = opendir(dirPath);
- if(dir == NULL) {
- DRM_TAPPS_EXCEPTION("AddCertSTOREFromDir Error : cannot open directory!");
- ret = -1;
- goto error;
- }
-
- for(;;) {
- error = readdir_r(dir, &entry, &result);
- if( error != 0 ) {
- DRM_TAPPS_EXCEPTION("AddCertSTOREFromDir Error : fail to read entries from a directory!");
- ret = -1;
- goto error;
- }
- // 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
- memset(file_path_buff, 0, sizeof(file_path_buff));
- snprintf(file_path_buff, sizeof(file_path_buff), "%s/%s", dirPath, entry.d_name);
- if(AddCertSTOREFromFile(pstStore, file_path_buff) == 0) {
- DRM_TAPPS_LOG("Add root cert : file=%s", file_path_buff);
- }else {
- DRM_TAPPS_LOG("Fail to add root cert : file=%s", file_path_buff);
- }
- }
- }
+ int ret = 0;
+
+ DIR *dir = NULL;
+ struct dirent entry;
+ struct dirent *result;
+ int error;
+ char file_path_buff[512];
+
+ if (pstStore == NULL || dirPath == NULL)
+ {
+ DRM_TAPPS_EXCEPTION("AddCertSTOREFromDir Error : Parameter error!");
+ ret = -1;
+ goto error;
+ }
+
+ dir = opendir(dirPath);
+ if(dir == NULL) {
+ DRM_TAPPS_EXCEPTION("AddCertSTOREFromDir Error : cannot open directory!");
+ ret = -1;
+ goto error;
+ }
+
+ for(;;) {
+ error = readdir_r(dir, &entry, &result);
+ if( error != 0 ) {
+ DRM_TAPPS_EXCEPTION("AddCertSTOREFromDir Error : fail to read entries from a directory!");
+ ret = -1;
+ goto error;
+ }
+ // 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
+ memset(file_path_buff, 0, sizeof(file_path_buff));
+ snprintf(file_path_buff, sizeof(file_path_buff), "%s/%s", dirPath, entry.d_name);
+ if(AddCertSTOREFromFile(pstStore, file_path_buff) == 0) {
+ DRM_TAPPS_LOG("Add root cert : file=%s", file_path_buff);
+ }else {
+ DRM_TAPPS_LOG("Fail to add root cert : file=%s", file_path_buff);
+ }
+ }
+ }