image_util_retvm_if(buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid buffer");
fp = fopen(path, "r");
- image_util_retvm_if(fp == NULL, IMAGE_UTIL_ERROR_NO_SUCH_FILE, "File open failed %s", path);
+ if (fp == NULL) {
+ if (errno == EACCES || errno == EPERM) {
+ image_util_error("Fail to open path: Permission Denied [%s]", path);
+ return IMAGE_UTIL_ERROR_PERMISSION_DENIED;
+ } else {
+ image_util_error("Fail to open path: Invalid Path [%s]", path);
+ return IMAGE_UTIL_ERROR_NO_SUCH_FILE;
+ }
+ }
read_buffer = (void *)calloc(1, IMG_HEADER_LENGTH + 1);
if (read_buffer == NULL) {