summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2020-03-30 13:30:00 +0900
committerMinje Ahn <minje.ahn@samsung.com>2020-03-30 14:54:15 +0900
commit7080a0ebd6bd64e49661e851902ea0312e3d480a (patch)
tree0dbcfa5ade3bd5c7ef38ed4b1042eeb4d392bd41
parent854f67afeb90b6610fc84e682fd72774b4ca37d2 (diff)
downloadlibmedia-thumbnail-7080a0ebd6bd64e49661e851902ea0312e3d480a.tar.gz
libmedia-thumbnail-7080a0ebd6bd64e49661e851902ea0312e3d480a.tar.bz2
libmedia-thumbnail-7080a0ebd6bd64e49661e851902ea0312e3d480a.zip
Change-Id: I1971d917c92d2bda2d50c14837cdbe03b5f88206 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rwxr-xr-xsrc/media-thumbnail.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index 2b986de..46b1f21 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -370,21 +370,25 @@ static int __check_path_validity(const char *path)
static int __check_thumb_path_validity(const char *path)
{
char *dir_name = NULL;
+ int ret = MS_MEDIA_ERR_NONE;
thumb_retvm_if(!path, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
dir_name = g_path_get_dirname(path);
- if (dir_name) {
- if (access(dir_name, W_OK) != 0) {
+
+ if (access(dir_name, W_OK) != 0) {
+ if (errno == EACCES || errno == EPERM) {
thumb_err("No permission to write[%s]", dir_name);
- SAFE_FREE(dir_name);
- return MS_MEDIA_ERR_PERMISSION_DENIED;
+ ret = MS_MEDIA_ERR_PERMISSION_DENIED;
+ } else {
+ thumb_err("Does not exists[%s]", dir_name);
+ ret = MS_MEDIA_ERR_INVALID_PARAMETER;
}
-
- SAFE_FREE(dir_name);
}
- return MS_MEDIA_ERR_NONE;
+ SAFE_FREE(dir_name);
+
+ return ret;
}
static int __check_parameter_validity_for_file(const char *path, unsigned int width, unsigned int height, const char *thumb_path)