summaryrefslogtreecommitdiff
path: root/src/media-thumbnail.c
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2016-06-02 23:56:19 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2016-06-03 00:59:47 (GMT)
commit95f392d7e44773c3572dab021b1300d481789843 (patch)
treea9470fc909e06efcee883cedfac50dce821b6e70 /src/media-thumbnail.c
parent475351f266dff36f54e378b1c3373fa832f798c8 (diff)
downloadlibmedia-thumbnail-95f392d7e44773c3572dab021b1300d481789843.zip
libmedia-thumbnail-95f392d7e44773c3572dab021b1300d481789843.tar.gz
libmedia-thumbnail-95f392d7e44773c3572dab021b1300d481789843.tar.bz2
Modify file test coderefs/changes/63/72863/2
Change-Id: Ia24f6c074be84a17181f7161cbfa52bf4bf14f97 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'src/media-thumbnail.c')
-rwxr-xr-xsrc/media-thumbnail.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index 1cbc719..dab1de7 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -139,16 +139,24 @@ int thumbnail_request_from_db_async(unsigned int request_id, const char *origin_
int thumbnail_request_extract_raw_data_async(int request_id, const char *origin_path, int width, int height, ThumbRawFunc func, void *user_data, uid_t uid)
{
int err = MS_MEDIA_ERR_NONE;
+ int exist = 0;
if (origin_path == NULL || request_id == 0) {
- thumb_err("Invalid parameter");
+ thumb_err("original path is NULL. Or there is an error in request_id.");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
- thumb_err("Original path(%s) doesn't exist.", origin_path);
+ /* check the file exits actually */
+ exist = open(origin_path, O_RDONLY);
+ if (exist < 0) {
+ thumb_err("Fail to open original_path[%s]", origin_path);
+ if (errno == EACCES || errno == EPERM)
+ return MS_MEDIA_ERR_PERMISSION_DENIED;
+ else
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
+ close(exist);
+
thumb_dbg_slog("Path : %s", origin_path);
thumbRawUserData *userData = (thumbRawUserData*)malloc(sizeof(thumbRawUserData));