summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rwxr-xr-xinclude/media-thumbnail.h14
-rwxr-xr-xserver/thumb-server-internal.c33
-rwxr-xr-xserver/thumb-server.c67
-rwxr-xr-xsrc/include/ipc/media-thumb-ipc.h10
-rwxr-xr-xsrc/include/media-thumb-internal.h6
-rwxr-xr-xsrc/include/util/media-thumb-db.h5
-rwxr-xr-xsrc/include/util/media-thumb-util.h5
-rwxr-xr-xsrc/ipc/media-thumb-ipc.c95
-rwxr-xr-xsrc/media-thumb-internal.c16
-rwxr-xr-xsrc/media-thumbnail.c28
-rwxr-xr-xsrc/util/media-thumb-db.c26
-rwxr-xr-xsrc/util/media-thumb-util.c115
-rwxr-xr-xtest/test-thumb.c10
14 files changed, 304 insertions, 128 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39c3a15..26cbfed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,7 +69,7 @@ ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
#ADD_DEFINITIONS("-D_PERFORMANCE_CHECK_")
ADD_DEFINITIONS("-D_USE_NEW_MEDIA_DB_")
ADD_DEFINITIONS("-D_USE_MEDIA_UTIL_")
-ADD_DEFINITIONS("-D_USE_UDS_SOCKET_TCP_")
+ADD_DEFINITIONS("-D_USE_UDS_SOCKET_")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--hash-style=both")
CONFIGURE_FILE(media-thumbnail.pc.in media-thumbnail.pc @ONLY)
diff --git a/include/media-thumbnail.h b/include/media-thumbnail.h
index 5b38585..1101258 100755
--- a/include/media-thumbnail.h
+++ b/include/media-thumbnail.h
@@ -23,6 +23,8 @@
#ifndef _MEDIA_THUMBNAIL_H_
#define _MEDIA_THUMBNAIL_H_
+#include <sys/types.h>
+
#include "media-thumb-types.h"
#include "media-thumb-error.h"
@@ -92,7 +94,7 @@ void gen_thumbs()
* @endcode
*/
-int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max_length);
+int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max_length, uid_t uid);
/**
* thumbnail_request_from_db_async:
@@ -137,7 +139,7 @@ void gen_thumbs()
* @endcode
*/
-int thumbnail_request_from_db_async(const char *origin_path, ThumbFunc func, void *user_data);
+int thumbnail_request_from_db_async(const char *origin_path, ThumbFunc func, void *user_data, uid_t uid);
/**
* thumbnail_request_save_to_file:
@@ -176,7 +178,7 @@ void save_thumbs()
*/
int thumbnail_request_save_to_file(const char *origin_path,
media_thumb_type thumb_type,
- const char *thumb_path);
+ const char *thumb_path, uid_t uid);
/**
@@ -210,12 +212,12 @@ void extract_all_thumbs()
* @endcode
*/
-int thumbnail_request_extract_all_thumbs(void);
+int thumbnail_request_extract_all_thumbs(uid_t uid);
-int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_path, int max_length, int *origin_width, int *origin_height);
+int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_path, int max_length, int *origin_width, int *origin_height, uid_t uid);
/* Cancel APIs that a request to extract thumbnail */
-int thumbnail_request_cancel_media(const char *origin_path);
+int thumbnail_request_cancel_media(const char *origin_path, uid_t uid);
/* Cancel APIs that all requests to extract thumbnail of a process */
int thumbnail_request_cancel_all();
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 0f3a949..cc65652 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -35,6 +35,7 @@
#define LOG_TAG "MEDIA_THUMBNAIL_SERVER"
static __thread char **arr_path;
+static __thread uid_t *arr_uid;
static __thread int g_idx = 0;
static __thread int g_cur_idx = 0;
@@ -48,8 +49,6 @@ void _thumb_daemon_stop_job();
gboolean _thumb_daemon_start_jobs(gpointer data)
{
thumb_dbg("");
- /* Initialize ecore-evas to use evas library */
- ecore_evas_init();
#ifdef _USE_MEDIA_UTIL_
_thumb_server_send_msg_to_agent(MS_MSG_THUMB_SERVER_READY);
@@ -152,11 +151,11 @@ void _thumb_daemon_stop_job()
return;
}
-int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg)
+int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
{
int err = -1;
- err = _media_thumb_process(req_msg, res_msg);
+ err = _media_thumb_process(req_msg, res_msg, uid);
if (err < 0) {
if (req_msg->msg_type == THUMB_REQUEST_SAVE_FILE) {
thumb_err("_media_thumb_process is failed: %d", err);
@@ -172,7 +171,7 @@ int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg)
return err;
}
-int _thumb_daemon_all_extract()
+int _thumb_daemon_all_extract(uid_t uid)
{
int err = -1;
int count = 0;
@@ -181,7 +180,7 @@ int _thumb_daemon_all_extract()
sqlite3 *sqlite_db_handle = NULL;
sqlite3_stmt *sqlite_stmt = NULL;
- err = _media_thumb_db_connect();
+ err = _media_thumb_db_connect(uid);
if (err < 0) {
thumb_err("_media_thumb_db_connect failed: %d", err);
return MEDIA_THUMB_ERROR_DB;
@@ -223,10 +222,12 @@ int _thumb_daemon_all_extract()
if (g_idx == 0) {
arr_path = (char**)malloc(sizeof(char*));
+ arr_uid = (uid_t*)malloc(sizeof(uid_t));
} else {
arr_path = (char**)realloc(arr_path, (g_idx + 1) * sizeof(char*));
+ arr_uid = (uid_t*)realloc(arr_uid, (g_idx + 1) * sizeof(uid_t));
}
-
+ arr_uid[g_idx] = uid;
arr_path[g_idx++] = strdup(path);
}
@@ -240,10 +241,12 @@ int _thumb_daemon_process_queue_jobs(gpointer data)
{
int err = -1;
char *path = NULL;
+ uid_t uid = NULL;
if (g_cur_idx < g_idx) {
thumb_dbg("There are %d jobs in the queue", g_idx - g_cur_idx);
thumb_dbg("Current idx : [%d]", g_cur_idx);
+ uid = arr_uid[g_cur_idx];
path = arr_path[g_cur_idx++];
thumbMsg recv_msg, res_msg;
@@ -255,11 +258,11 @@ int _thumb_daemon_process_queue_jobs(gpointer data)
strncpy(recv_msg.org_path, path, sizeof(recv_msg.org_path));
recv_msg.org_path[sizeof(recv_msg.org_path) - 1] = '\0';
- _thumb_daemon_process_job(&recv_msg, &res_msg);
+ _thumb_daemon_process_job(&recv_msg, &res_msg,uid );
if (res_msg.status == THUMB_SUCCESS) {
- err = _media_thumb_db_connect();
+ err = _media_thumb_db_connect(uid);
if (err < 0) {
thumb_err("_media_thumb_mb_svc_connect failed: %d", err);
return TRUE;
@@ -269,7 +272,8 @@ int _thumb_daemon_process_queue_jobs(gpointer data)
err = _media_thumb_update_db(recv_msg.org_path,
res_msg.dst_path,
res_msg.origin_width,
- res_msg.origin_height);
+ res_msg.origin_height,
+ uid);
if (err < 0) {
thumb_err("_media_thumb_update_db failed : %d", err);
}
@@ -283,6 +287,7 @@ int _thumb_daemon_process_queue_jobs(gpointer data)
g_idx = 0;
thumb_warn("Deleting array");
SAFE_FREE(arr_path);
+ SAFE_FREE(arr_uid);
//_media_thumb_db_disconnect();
_thumb_server_send_msg_to_agent(MS_MSG_THUMB_EXTRACT_ALL_DONE); // MS_MSG_THUMB_EXTRACT_ALL_DONE
@@ -350,14 +355,14 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
if (recv_msg.msg_type == THUMB_REQUEST_ALL_MEDIA) {
thumb_dbg("All thumbnails are being extracted now");
- _thumb_daemon_all_extract();
+ _thumb_daemon_all_extract(recv_msg.uid);
g_idle_add(_thumb_daemon_process_queue_jobs, NULL);
} else if(recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
thumb_warn("received KILL msg from thumbnail agent.");
} else {
long start = thumb_get_debug_time();
- _thumb_daemon_process_job(&recv_msg, &res_msg);
+ _thumb_daemon_process_job(&recv_msg, &res_msg,recv_msg.uid);
long end = thumb_get_debug_time();
thumb_dbg("Time : %f (%s)", ((double)(end - start) / (double)CLOCKS_PER_SEC), recv_msg.org_path);
@@ -399,7 +404,7 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
if(recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
thumb_warn("Shutting down...");
- g_main_loop_quit(g_thumb_server_mainloop);
+ ecore_main_loop_quit();
}
return TRUE;
@@ -429,7 +434,7 @@ gboolean _thumb_server_send_msg_to_agent(int msg_type)
memset(&serv_addr, 0, sizeof(serv_addr));
#ifdef _USE_UDS_SOCKET_
serv_addr.sun_family = AF_UNIX;
- strcpy(serv_addr.sun_path, "/tmp/media_ipc_thumbcomm.dat");
+ strcpy(serv_addr.sun_path, "/var/run/media-server/media_ipc_thumbcomm.socket");
#else
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = inet_addr(serv_ip);
diff --git a/server/thumb-server.c b/server/thumb-server.c
index db17571..bed8711 100755
--- a/server/thumb-server.c
+++ b/server/thumb-server.c
@@ -49,42 +49,26 @@ static void _media_thumb_signal_handler(void *user_data)
thumb_dbg("Singal Hander for HEYNOTI \"power_off_start\"");
if (g_thumb_server_mainloop)
- g_main_loop_quit(g_thumb_server_mainloop);
- else
+ ecore_main_loop_quit();
+ else
exit(1);
return;
}
-
-void* gmainloop_thread(void *data)
+int main()
{
- GSource *source = NULL;
- GIOChannel *channel = (GIOChannel *)data;
- GMainContext *context = NULL;
-
- g_thumb_server_mainloop = g_main_loop_new(context, FALSE);
- context = g_main_loop_get_context(g_thumb_server_mainloop);
-
- source = g_io_create_watch(channel, G_IO_IN);
+
+ int sockfd = -1;
- /* Set callback to be called when socket is readable */
- g_source_set_callback(source, (GSourceFunc)_thumb_server_read_socket, NULL, NULL);
- g_source_attach(source, context);
-
- g_main_loop_run(g_thumb_server_mainloop);
-
- pthread_exit(NULL);
-}
+ GSource *source = NULL;
+ GIOChannel *channel = NULL;
+ GMainContext *context = NULL;
-int main()
-{
/*heynoti for power off*/
int err = 0;
int heynoti_id = heynoti_init();
- int sockfd = -1;
-
if (heynoti_id < 0) {
thumb_err("heynoti_init failed");
} else {
@@ -98,12 +82,6 @@ int main()
}
}
- /* Create and bind new UDP socket */
- if (!_thumb_server_prepare_socket(&sockfd)) {
- thumb_err("Failed to create socket\n");
- return -1;
- }
-
/* Set VCONFKEY_SYSMAN_MMC_FORMAT callback to get noti for SD card format */
err = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_FORMAT, (vconf_callback_fn) _thumb_daemon_vconf_cb, NULL);
if (err == -1)
@@ -114,6 +92,27 @@ int main()
if (err == -1)
thumb_err("vconf_notify_key_changed : %s fails", VCONFKEY_SYSMAN_MMC_STATUS);
+ /* Create and bind new UDP socket */
+ if (!_thumb_server_prepare_socket(&sockfd)) {
+ thumb_err("Failed to create socket\n");
+ return -1;
+ }
+
+ context = g_main_context_default ();
+
+ /* Create new channel to watch udp socket */
+ channel = g_io_channel_unix_new(sockfd);
+ source = g_io_create_watch(channel, G_IO_IN);
+
+ /* Set callback to be called when socket is readable */
+ g_source_set_callback(source, (GSourceFunc)_thumb_server_read_socket, NULL, NULL);
+ g_source_attach(source, context);
+
+ GSource *source_evas_init = NULL;
+ source_evas_init = g_idle_source_new ();
+ g_source_set_callback (source_evas_init, _thumb_daemon_start_jobs, NULL, NULL);
+ g_source_attach (source_evas_init, context);
+
/* Would be used when glib 2.32 is installed
GSource *sig_handler_src = NULL;
sig_handler_src = g_unix_signal_source_new (SIGTERM);
@@ -122,13 +121,6 @@ int main()
*/
ecore_evas_init();
- GIOChannel *channel = NULL;
- /* Create new channel to watch udp socket */
- channel = g_io_channel_unix_new(sockfd);
-
- static pthread_t thread;
- pthread_create(&thread, NULL, gmainloop_thread, channel);
-
thumb_dbg("************************************");
thumb_dbg("*** Thumbnail server is running ***");
thumb_dbg("************************************");
@@ -140,7 +132,6 @@ int main()
g_io_channel_shutdown(channel, FALSE, NULL);
g_io_channel_unref(channel);
_thumb_daemon_finish_jobs();
- g_main_loop_unref(g_thumb_server_mainloop);
return 0;
}
diff --git a/src/include/ipc/media-thumb-ipc.h b/src/include/ipc/media-thumb-ipc.h
index ce81c01..1819af4 100755
--- a/src/include/ipc/media-thumb-ipc.h
+++ b/src/include/ipc/media-thumb-ipc.h
@@ -42,6 +42,7 @@
#include <unistd.h>
#include <errno.h>
#include <signal.h>
+#include <sys/types.h>
#ifndef _MEDIA_THUMB_IPC_H_
#define _MEDIA_THUMB_IPC_H_
@@ -83,6 +84,7 @@ typedef struct _thumbMsg{
media_thumb_type thumb_type;
int status;
int pid;
+ uid_t uid;
int thumb_size;
int thumb_width;
int thumb_height;
@@ -121,15 +123,17 @@ _media_thumb_request(int msg_type,
const char *origin_path,
char *thumb_path,
int max_length,
- media_thumb_info *thumb_info);
+ media_thumb_info *thumb_info,
+ uid_t uid);
int
_media_thumb_request_async(int msg_type,
media_thumb_type thumb_type,
const char *origin_path,
- thumbUserData *userData);
+ thumbUserData *userData,
+ uid_t uid);
int
-_media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg);
+_media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid);
#endif /*_MEDIA_THUMB_IPC_H_*/
diff --git a/src/include/media-thumb-internal.h b/src/include/media-thumb-internal.h
index 0180a29..32427ca 100755
--- a/src/include/media-thumb-internal.h
+++ b/src/include/media-thumb-internal.h
@@ -69,13 +69,15 @@ _media_thumb_image(const char *origin_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
- media_thumb_info *thumb_info);
+ media_thumb_info *thumb_info,
+ uid_t uid);
int
_media_thumb_video(const char *origin_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
- media_thumb_info *thumb_info);
+ media_thumb_info *thumb_info,
+ uid_t uid);
#endif /*_MEDIA_THUMB_INTERNAL_H_*/
diff --git a/src/include/util/media-thumb-db.h b/src/include/util/media-thumb-db.h
index effd3f4..b29920a 100755
--- a/src/include/util/media-thumb-db.h
+++ b/src/include/util/media-thumb-db.h
@@ -51,7 +51,7 @@
sqlite3 *_media_thumb_db_get_handle();
int
-_media_thumb_db_connect();
+_media_thumb_db_connect(uid_t uid);
int
_media_thumb_db_disconnect();
@@ -74,7 +74,8 @@ int
_media_thumb_update_db(const char *origin_path,
char *thumb_path,
int width,
- int height);
+ int height,
+ uid_t uid);
#endif /*_MEDIA_THUMB_DB_H_*/
diff --git a/src/include/util/media-thumb-util.h b/src/include/util/media-thumb-util.h
index 20c54bb..2b2723e 100755
--- a/src/include/util/media-thumb-util.h
+++ b/src/include/util/media-thumb-util.h
@@ -72,7 +72,7 @@ char
int
_media_thumb_get_hash_name(const char *file_full_path,
- char *thumb_hash_path, size_t max_thumb_path);
+ char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
int
_media_thumb_save_to_file_with_evas(unsigned char *data,
@@ -141,7 +141,8 @@ int _thumbnail_get_data(const char *origin_path,
int *height,
int *origin_width,
int *origin_height,
- int *alpha);
+ int *alpha,
+ uid_t uid);
#endif /*_MEDIA_THUMB_UTIL_H_*/
diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c
index 23f9960..91e0db6 100755
--- a/src/ipc/media-thumb-ipc.c
+++ b/src/ipc/media-thumb-ipc.c
@@ -27,6 +27,10 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
+#include <grp.h>
+#include <pwd.h>
+
+#define GLOBAL_USER 0 //#define tzplatform_getenv(TZ_GLOBAL) //TODO
static __thread GQueue *g_request_queue = NULL;
typedef struct {
@@ -312,7 +316,7 @@ _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size)
}
int
-_media_thumb_request(int msg_type, media_thumb_type thumb_type, const char *origin_path, char *thumb_path, int max_length, media_thumb_info *thumb_info)
+_media_thumb_request(int msg_type, media_thumb_type thumb_type, const char *origin_path, char *thumb_path, int max_length, media_thumb_info *thumb_info, uid_t uid)
{
int sock;
#ifdef _USE_UDS_SOCKET_
@@ -360,10 +364,10 @@ _media_thumb_request(int msg_type, media_thumb_type thumb_type, const char *orig
#ifdef _USE_MEDIA_UTIL_
#ifdef _USE_UDS_SOCKET_
- strcpy(serv_addr.sun_path, "/tmp/media_ipc_thumbcreator.dat");
+ strcpy(serv_addr.sun_path, "/var/run/media-server/media_ipc_thumbcreator.socket");
#elif defined(_USE_UDS_SOCKET_TCP_)
thumb_dbg("");
- strcpy(serv_addr.sun_path, "/tmp/media_ipc_thumbcreator.dat");
+ strcpy(serv_addr.sun_path, "/var/run/media-server/media_ipc_thumbcreator.socket");
#else
serv_addr.sin_port = htons(MS_THUMB_CREATOR_PORT);
#endif
@@ -390,6 +394,7 @@ _media_thumb_request(int msg_type, media_thumb_type thumb_type, const char *orig
/* Set requset message */
req_msg.msg_type = msg_type;
req_msg.thumb_type = thumb_type;
+ req_msg.uid = uid;
strncpy(req_msg.org_path, origin_path, sizeof(req_msg.org_path));
req_msg.org_path[strlen(req_msg.org_path)] = '\0';
@@ -456,8 +461,66 @@ _media_thumb_request(int msg_type, media_thumb_type thumb_type, const char *orig
return 0;
}
+static int _mkdir(const char *dir, mode_t mode) {
+ char tmp[256];
+ char *p = NULL;
+ size_t len;
+
+ snprintf(tmp, sizeof(tmp),"%s",dir);
+ len = strlen(tmp);
+ if(tmp[len - 1] == '/')
+ tmp[len - 1] = 0;
+ for(p = tmp + 1; *p; p++)
+ if(*p == '/') {
+ *p = 0;
+ mkdir(tmp, mode);
+ *p = '/';
+ }
+ return mkdir(tmp, mode);
+}
+
+static char* _media_thumb_get_default_path(uid_t uid)
+{
+ char *result_psswd = NULL;
+ struct group *grpinfo = NULL;
+ char * dir = NULL;
+ if(uid == GLOBAL_USER)
+ {
+ result_psswd = strdup(THUMB_DEFAULT_PATH);
+ grpinfo = getgrnam("root");
+ if(grpinfo == NULL) {
+ thumb_err("getgrnam(users) returns NULL !");
+ return NULL;
+ }
+ }
+ else
+ {
+ struct passwd *userinfo = getpwuid(uid);
+ if(userinfo == NULL) {
+ thumb_err("getpwuid(%d) returns NULL !", uid);
+ return NULL;
+ }
+ grpinfo = getgrnam("users");
+ if(grpinfo == NULL) {
+ thumb_err("getgrnam(users) returns NULL !");
+ return NULL;
+ }
+ // Compare git_t type and not group name
+ if (grpinfo->gr_gid != userinfo->pw_gid) {
+ thumb_err("UID [%d] does not belong to 'users' group!", uid);
+ return NULL;
+ }
+ asprintf(&result_psswd, "%s/data/file-manager-service/.thumb/phone", userinfo->pw_dir);
+ }
+
+ /* create dir */
+ _mkdir(result_psswd,S_IRWXU | S_IRWXG | S_IRWXO);
+
+ return result_psswd;
+}
+
int
-_media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
+_media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
{
int err = -1;
unsigned char *data = NULL;
@@ -486,7 +549,7 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
thumb_path[0] = '\0';
max_length = sizeof(res_msg->dst_path);
- err = _media_thumb_db_connect();
+ err = _media_thumb_db_connect(uid);
if (err < 0) {
thumb_err("_media_thumb_mb_svc_connect failed: %d", err);
return MEDIA_THUMB_ERROR_DB;
@@ -501,10 +564,10 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
return MEDIA_THUMB_ERROR_NONE;
} else {
if (strlen(thumb_path) == 0) {
- err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length);
+ err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length,uid);
if (err < 0) {
thumb_err("_media_thumb_get_hash_name failed - %d\n", err);
- strncpy(thumb_path, THUMB_DEFAULT_PATH, max_length);
+ strncpy(thumb_path, _media_thumb_get_default_path(uid), max_length);
_media_thumb_db_disconnect();
return err;
}
@@ -517,10 +580,10 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
strncpy(thumb_path, req_msg->dst_path, max_length);
} else if (msg_type == THUMB_REQUEST_ALL_MEDIA) {
- err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length);
+ err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length,uid);
if (err < 0) {
thumb_err("_media_thumb_get_hash_name failed - %d\n", err);
- strncpy(thumb_path, THUMB_DEFAULT_PATH, max_length);
+ strncpy(thumb_path, _media_thumb_get_default_path(uid), max_length);
_media_thumb_db_disconnect();
return err;
}
@@ -528,20 +591,18 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
thumb_path[strlen(thumb_path)] = '\0';
}
- thumb_dbg("Thumb path : %s", thumb_path);
-
if (g_file_test(thumb_path,
G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
thumb_warn("thumb path already exists in file system.. remove the existed file");
_media_thumb_remove_file(thumb_path);
}
- err = _thumbnail_get_data(origin_path, thumb_type, thumb_format, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha);
+ err = _thumbnail_get_data(origin_path, thumb_type, thumb_format, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, uid);
if (err < 0) {
thumb_err("_thumbnail_get_data failed - %d\n", err);
SAFE_FREE(data);
- strncpy(thumb_path, THUMB_DEFAULT_PATH, max_length);
+ strncpy(thumb_path, _media_thumb_get_default_path(uid), max_length);
_media_thumb_db_disconnect();
return err;
}
@@ -576,7 +637,7 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
SAFE_FREE(data);
if (msg_type == THUMB_REQUEST_DB_INSERT || msg_type == THUMB_REQUEST_ALL_MEDIA)
- strncpy(thumb_path, THUMB_DEFAULT_PATH, max_length);
+ strncpy(thumb_path, _media_thumb_get_default_path(uid), max_length);
_media_thumb_db_disconnect();
return err;
@@ -603,7 +664,7 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
/* DB update if needed */
if (need_update_db == 1) {
- err = _media_thumb_update_db(origin_path, thumb_path, res_msg->origin_width, res_msg->origin_height);
+ err = _media_thumb_update_db(origin_path, thumb_path, res_msg->origin_width, res_msg->origin_height, uid);
if (err < 0) {
thumb_err("_media_thumb_update_db failed : %d", err);
}
@@ -662,7 +723,7 @@ callback:
}
int
-_media_thumb_request_async(int msg_type, media_thumb_type thumb_type, const char *origin_path, thumbUserData *userData)
+_media_thumb_request_async(int msg_type, media_thumb_type thumb_type, const char *origin_path, thumbUserData *userData, uid_t uid)
{
int sock;
#ifdef _USE_UDS_SOCKET_
@@ -752,6 +813,8 @@ _media_thumb_request_async(int msg_type, media_thumb_type thumb_type, const char
req_msg.pid = pid;
req_msg.msg_type = msg_type;
req_msg.thumb_type = thumb_type;
+ req_msg.uid = uid;
+
strncpy(req_msg.org_path, origin_path, sizeof(req_msg.org_path));
req_msg.org_path[strlen(req_msg.org_path)] = '\0';
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index 0feee8a..fc0ca00 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -169,7 +169,7 @@ _media_thumb_get_thumb_from_exif(ExifData *ed,
int orientation,
int required_width,
int required_height,
- media_thumb_info *thumb_info)
+ media_thumb_info *thumb_info, uid_t uid)
{
ExifEntry *entry;
ExifIfd ifd;
@@ -278,7 +278,7 @@ _media_thumb_get_thumb_from_exif(ExifData *ed,
err =
_media_thumb_get_hash_name(file_full_path,
thumb_path,
- sizeof(thumb_path));
+ sizeof(thumb_path), uid);
if (err < 0) {
thumb_dbg("_media_thumb_get_hash_name failed\n");
SAFE_FREE(thumb);
@@ -951,7 +951,8 @@ int _media_thumb_jpeg(const char *origin_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
- media_thumb_info *thumb_info)
+ media_thumb_info *thumb_info,
+ uid_t uid)
{
int err = -1;
ExifData *ed = NULL;
@@ -970,7 +971,7 @@ int _media_thumb_jpeg(const char *origin_path,
}
/* Second, Get thumb from exif */
- err = _media_thumb_get_thumb_from_exif(ed, origin_path, orientation, thumb_width, thumb_height, thumb_info);
+ err = _media_thumb_get_thumb_from_exif(ed, origin_path, orientation, thumb_width, thumb_height, thumb_info, uid);
if (err < 0) {
thumb_dbg("_media_thumb_get_thumb_from_exif failed");
@@ -1021,7 +1022,7 @@ _media_thumb_image(const char *origin_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
- media_thumb_info *thumb_info)
+ media_thumb_info *thumb_info, uid_t uid)
{
int err = -1;
int image_type = 0;
@@ -1045,7 +1046,7 @@ _media_thumb_image(const char *origin_path,
if (image_type == IMG_CODEC_AGIF) {
err = _media_thumb_agif(origin_path, &image_info, thumb_width, thumb_height, format, thumb_info);
} else if (image_type == IMG_CODEC_JPEG) {
- err = _media_thumb_jpeg(origin_path, thumb_width, thumb_height, format, thumb_info);
+ err = _media_thumb_jpeg(origin_path, thumb_width, thumb_height, format, thumb_info, uid);
} else if (image_type == IMG_CODEC_PNG) {
err = _media_thumb_png(origin_path, thumb_width, thumb_height, format, thumb_info);
} else if (image_type == IMG_CODEC_GIF) {
@@ -1095,7 +1096,8 @@ _media_thumb_video(const char *origin_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
- media_thumb_info *thumb_info)
+ media_thumb_info *thumb_info,
+ uid_t uid)
{
int err = -1;
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index 420414e..c52c42a 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -28,7 +28,7 @@
#include <glib.h>
-int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max_length)
+int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max_length, uid_t uid)
{
int err = -1;
//int need_update_db = 0;
@@ -73,7 +73,7 @@ int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max
}
*/
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info);
+ err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info, uid);
if (err < 0) {
thumb_err("_media_thumb_request failed : %d", err);
//_media_thumb_db_disconnect();
@@ -93,7 +93,7 @@ int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max
return MEDIA_THUMB_ERROR_NONE;
}
-int thumbnail_request_save_to_file(const char *origin_path, media_thumb_type thumb_type, const char *thumb_path)
+int thumbnail_request_save_to_file(const char *origin_path, media_thumb_type thumb_type, const char *thumb_path, uid_t uid)
{
int err = -1;
@@ -109,7 +109,7 @@ int thumbnail_request_save_to_file(const char *origin_path, media_thumb_type thu
tmp_thumb_path[sizeof(tmp_thumb_path) - 1] = '\0';
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_SAVE_FILE, thumb_type, origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info);
+ err = _media_thumb_request(THUMB_REQUEST_SAVE_FILE, thumb_type, origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
if (err < 0) {
thumb_err("_media_thumb_request failed : %d", err);
return err;
@@ -118,7 +118,7 @@ int thumbnail_request_save_to_file(const char *origin_path, media_thumb_type thu
return MEDIA_THUMB_ERROR_NONE;
}
-int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_path, int max_length, int *origin_width, int *origin_height)
+int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_path, int max_length, int *origin_width, int *origin_height, uid_t uid)
{
int err = -1;
//int need_update_db = 0;
@@ -168,7 +168,7 @@ int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_pat
}
*/
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info);
+ err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info, uid);
if (err < 0) {
thumb_err("_media_thumb_request failed : %d", err);
//_media_thumb_db_disconnect();
@@ -182,7 +182,7 @@ int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_pat
return MEDIA_THUMB_ERROR_NONE;
}
-int thumbnail_request_extract_all_thumbs(void)
+int thumbnail_request_extract_all_thumbs(uid_t uid)
{
int err = -1;
@@ -192,7 +192,7 @@ int thumbnail_request_extract_all_thumbs(void)
char tmp_thumb_path[MAX_PATH_SIZE] = {0,};
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_ALL_MEDIA, thumb_type, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info);
+ err = _media_thumb_request(THUMB_REQUEST_ALL_MEDIA, thumb_type, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
if (err < 0) {
thumb_err("_media_thumb_request failed : %d", err);
return err;
@@ -201,7 +201,7 @@ int thumbnail_request_extract_all_thumbs(void)
return MEDIA_THUMB_ERROR_NONE;
}
-int thumbnail_request_from_db_async(const char *origin_path, ThumbFunc func, void *user_data)
+int thumbnail_request_from_db_async(const char *origin_path, ThumbFunc func, void *user_data, uid_t uid)
{
int err = -1;
@@ -231,7 +231,7 @@ int thumbnail_request_from_db_async(const char *origin_path, ThumbFunc func, voi
userData->user_data = user_data;
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request_async(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, userData);
+ err = _media_thumb_request_async(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, userData, uid);
if (err < 0) {
thumb_err("_media_thumb_request failed : %d", err);
SAFE_FREE(userData);
@@ -249,7 +249,7 @@ int _media_thumbnail_cancel_cb(int error_code, char* path, void* data)
return MEDIA_THUMB_ERROR_NONE;
}
-int thumbnail_request_cancel_media(const char *origin_path)
+int thumbnail_request_cancel_media(const char *origin_path, uid_t uid)
{
int err = -1;
@@ -260,7 +260,7 @@ int thumbnail_request_cancel_media(const char *origin_path)
return MEDIA_THUMB_ERROR_INVALID_PARAMETER;
}
- err = _media_thumb_request_async(THUMB_REQUEST_CANCEL_MEDIA, thumb_type, origin_path, NULL);
+ err = _media_thumb_request_async(THUMB_REQUEST_CANCEL_MEDIA, thumb_type, origin_path, NULL, uid);
if (err < 0) {
thumb_err("_media_thumb_request failed : %d", err);
return err;
@@ -269,7 +269,7 @@ int thumbnail_request_cancel_media(const char *origin_path)
return MEDIA_THUMB_ERROR_NONE;
}
-int thumbnail_request_cancel_all()
+int thumbnail_request_cancel_all(uid_t uid)
{
int err = -1;
@@ -279,7 +279,7 @@ int thumbnail_request_cancel_all()
char tmp_thumb_path[MAX_PATH_SIZE] = {0,};
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_CANCEL_ALL, thumb_type, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info);
+ err = _media_thumb_request(THUMB_REQUEST_CANCEL_ALL, thumb_type, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
if (err < 0) {
thumb_err("_media_thumb_request failed : %d", err);
return err;
diff --git a/src/util/media-thumb-db.c b/src/util/media-thumb-db.c
index e3ca193..1ee9aa5 100755
--- a/src/util/media-thumb-db.c
+++ b/src/util/media-thumb-db.c
@@ -241,7 +241,8 @@ _media_thumb_get_thumb_path_from_db(sqlite3 *handle,
int
_media_thumb_update_thumb_path_to_db(sqlite3 *handle,
const char *origin_path,
- char *thumb_path)
+ char *thumb_path,
+ uid_t uid)
{
thumb_dbg("");
int err = -1;
@@ -281,7 +282,7 @@ _media_thumb_update_thumb_path_to_db(sqlite3 *handle,
if (err_msg)
sqlite3_free(err_msg);
#else
- err = media_db_request_update_db(query_string);
+ err = media_db_request_update_db(query_string, uid);
if (err < 0) {
thumb_err("media_db_request_update_db failed : %d", err);
return err;
@@ -296,7 +297,8 @@ int
_media_thumb_update_wh_to_db(sqlite3 *handle,
const char *origin_path,
int width,
- int height)
+ int height,
+ uid_t uid)
{
thumb_dbg("");
int err = -1;
@@ -333,7 +335,7 @@ _media_thumb_update_wh_to_db(sqlite3 *handle,
if (err_msg)
sqlite3_free(err_msg);
#else
- err = media_db_request_update_db(query_string);
+ err = media_db_request_update_db(query_string, uid);
if (err < 0) {
thumb_err("media_db_request_update_db failed : %d", err);
return err;
@@ -349,7 +351,8 @@ _media_thumb_update_thumb_path_wh_to_db(sqlite3 *handle,
const char *origin_path,
char *thumb_path,
int width,
- int height)
+ int height,
+ uid_t uid)
{
thumb_dbg("");
int err = -1;
@@ -364,7 +367,7 @@ _media_thumb_update_thumb_path_wh_to_db(sqlite3 *handle,
path_string = sqlite3_mprintf("%s", origin_path);
query_string = sqlite3_mprintf(UPDATE_THUMB_WH_BY_PATH, thumb_path, width, height, path_string);
- err = media_db_request_update_db(query_string);
+ err = media_db_request_update_db(query_string, uid);
if (err < 0) {
thumb_err("media_db_request_update_db failed : %d", err);
return err;
@@ -376,7 +379,7 @@ _media_thumb_update_thumb_path_wh_to_db(sqlite3 *handle,
}
int
-_media_thumb_db_connect()
+_media_thumb_db_connect(uid_t uid)
{
int err = -1;
/*
@@ -395,7 +398,7 @@ _media_thumb_db_connect()
return err;
}
#else
- err = media_db_connect(&db_handle);
+ err = media_db_connect(&db_handle,uid);
if (err < 0) {
thumb_err("media_db_connect failed: %d", err);
db_handle = NULL;
@@ -528,7 +531,8 @@ int
_media_thumb_update_db(const char *origin_path,
char *thumb_path,
int width,
- int height)
+ int height,
+ uid_t uid)
{
thumb_dbg("");
int err = -1;
@@ -588,13 +592,13 @@ _media_thumb_update_db(const char *origin_path,
}
#else
if (media_type == THUMB_IMAGE_TYPE && width > 0 && height > 0) {
- err = _media_thumb_update_thumb_path_wh_to_db(db_handle, origin_path, thumb_path, width, height);
+ err = _media_thumb_update_thumb_path_wh_to_db(db_handle, origin_path, thumb_path, width, height,uid);
if (err < 0) {
thumb_err("_media_thumb_update_wh_to_db (%s) failed: %d", origin_path, err);
return MEDIA_THUMB_ERROR_DB;
}
} else {
- err = _media_thumb_update_thumb_path_to_db(db_handle, origin_path, thumb_path);
+ err = _media_thumb_update_thumb_path_to_db(db_handle, origin_path, thumb_path, uid);
if (err < 0) {
thumb_err("_media_thumb_update_thumb_path_to_db (%s) failed: %d", origin_path, err);
return MEDIA_THUMB_ERROR_DB;
diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c
index 0db4133..d6cd9cf 100755
--- a/src/util/media-thumb-util.c
+++ b/src/util/media-thumb-util.c
@@ -29,6 +29,10 @@
#include <Evas.h>
#include <Ecore_Evas.h>
+#include <grp.h>
+#include <pwd.h>
+
+#define GLOBAL_USER 0 //#define tzplatform_getenv(TZ_GLOBAL) //TODO
int _media_thumb_get_width(media_thumb_type thumb_type)
{
@@ -195,9 +199,105 @@ int _media_thumb_remove_file(const char *path)
}
}
+static int _mkdir(const char *dir, mode_t mode) {
+ char tmp[256];
+ char *p = NULL;
+ size_t len;
+
+ snprintf(tmp, sizeof(tmp),"%s",dir);
+ len = strlen(tmp);
+ if(tmp[len - 1] == '/')
+ tmp[len - 1] = 0;
+ for(p = tmp + 1; *p; p++)
+ if(*p == '/') {
+ *p = 0;
+ mkdir(tmp, mode);
+ *p = '/';
+ }
+ return mkdir(tmp, mode);
+}
+
+static char* _media_thumb_mmc_get_path(uid_t uid)
+{
+ char *result_psswd = NULL;
+ struct group *grpinfo = NULL;
+ char * dir = NULL;
+ if(uid == GLOBAL_USER)
+ {
+ result_psswd = strdup(THUMB_MMC_PATH);
+ grpinfo = getgrnam("root");
+ if(grpinfo == NULL) {
+ thumb_err("getgrnam(users) returns NULL !");
+ return NULL;
+ }
+ }
+ else
+ {
+ struct passwd *userinfo = getpwuid(uid);
+ if(userinfo == NULL) {
+ thumb_err("getpwuid(%d) returns NULL !", uid);
+ return NULL;
+ }
+ grpinfo = getgrnam("users");
+ if(grpinfo == NULL) {
+ thumb_err("getgrnam(users) returns NULL !");
+ return NULL;
+ }
+ // Compare git_t type and not group name
+ if (grpinfo->gr_gid != userinfo->pw_gid) {
+ thumb_err("UID [%d] does not belong to 'users' group!", uid);
+ return NULL;
+ }
+ asprintf(&result_psswd, "%s/data/file-manager-service/.thumb/mmc", userinfo->pw_dir);
+ }
+
+ _mkdir(result_psswd,S_IRWXU | S_IRWXG | S_IRWXO);
+
+ return result_psswd;
+}
+
+static char* _media_thumb_phone_get_path(uid_t uid)
+{
+ char *result_psswd = NULL;
+ struct group *grpinfo = NULL;
+ char * dir = NULL;
+ if(uid == GLOBAL_USER)
+ {
+ result_psswd = strdup(THUMB_PHONE_PATH);
+ grpinfo = getgrnam("root");
+ if(grpinfo == NULL) {
+ thumb_err("getgrnam(users) returns NULL !");
+ return NULL;
+ }
+ }
+ else
+ {
+ struct passwd *userinfo = getpwuid(uid);
+ if(userinfo == NULL) {
+ thumb_err("getpwuid(%d) returns NULL !", uid);
+ return NULL;
+ }
+ grpinfo = getgrnam("users");
+ if(grpinfo == NULL) {
+ thumb_err("getgrnam(users) returns NULL !");
+ return NULL;
+ }
+ // Compare git_t type and not group name
+ if (grpinfo->gr_gid != userinfo->pw_gid) {
+ thumb_err("UID [%d] does not belong to 'users' group!", uid);
+ return NULL;
+ }
+ asprintf(&result_psswd, "%s/data/file-manager-service/.thumb/phone", userinfo->pw_dir);
+ }
+
+ _mkdir(result_psswd,S_IRWXU | S_IRWXG | S_IRWXO);
+
+ return result_psswd;
+}
+
int
_media_thumb_get_hash_name(const char *file_full_path,
- char *thumb_hash_path, size_t max_thumb_path)
+ char *thumb_hash_path, size_t max_thumb_path, uid_t uid)
{
char *hash_name;
char *thumb_dir = NULL;
@@ -215,11 +315,11 @@ _media_thumb_get_hash_name(const char *file_full_path,
store_type = _media_thumb_get_store_type_by_path(file_full_path);
if (store_type == THUMB_PHONE) {
- thumb_dir = THUMB_PHONE_PATH;
+ thumb_dir = _media_thumb_phone_get_path(uid);
} else if (store_type == THUMB_MMC) {
- thumb_dir = THUMB_MMC_PATH;
+ thumb_dir = _media_thumb_mmc_get_path(uid);
} else {
- thumb_dir = THUMB_PHONE_PATH;
+ thumb_dir = _media_thumb_phone_get_path(uid);
}
hash_name = _media_thumb_generate_hash_name(file_full_path);
@@ -303,7 +403,8 @@ int _thumbnail_get_data(const char *origin_path,
int *height,
int *origin_width,
int *origin_height,
- int *alpha)
+ int *alpha,
+ uid_t uid)
{
int err = -1;
int thumb_width = -1;
@@ -345,14 +446,14 @@ int _thumbnail_get_data(const char *origin_path,
file_type = _media_thumb_get_file_type(origin_path);
if (file_type == THUMB_IMAGE_TYPE) {
- err = _media_thumb_image(origin_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_image(origin_path, thumb_width, thumb_height, format, &thumb_info, uid);
if (err < 0) {
thumb_err("_media_thumb_image failed");
return err;
}
} else if (file_type == THUMB_VIDEO_TYPE) {
- err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info,uid);
if (err < 0) {
thumb_err("_media_thumb_image failed");
return err;
diff --git a/test/test-thumb.c b/test/test-thumb.c
index 41fcb6e..9fd5308 100755
--- a/test/test-thumb.c
+++ b/test/test-thumb.c
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
long start = thumb_get_debug_time();
- err = _thumbnail_get_data(origin_path, thumb_type, thumb_format, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha);
+ err = _thumbnail_get_data(origin_path, thumb_type, thumb_format, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, tzplatform_getuid(TZ_USER_NAME));
if (err < 0) {
printf("_thumbnail_get_data failed - %d\n", err);
return -1;
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
//const char *origin_path = "/opt/media/test/movie2.avi";
char thumb_path[MAX_PATH_SIZE + 1];
- err = thumbnail_request_from_db(origin_path, thumb_path, sizeof(thumb_path));
+ err = thumbnail_request_from_db(origin_path, thumb_path, sizeof(thumb_path), tzplatform_getuid(TZ_USER_NAME));
if (err < 0) {
printf("thumbnail_request_from_db failed : %d\n", err);
return -1;
@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
return -1;
}
- err = thumbnail_request_save_to_file(origin_path, MEDIA_THUMB_LARGE, thumb_path);
+ err = thumbnail_request_save_to_file(origin_path, MEDIA_THUMB_LARGE, thumb_path, tzplatform_getuid(TZ_USER_NAME));
if (err < 0) {
printf("thumbnail_request_save_to_file failed : %d\n", err);
return -1;
@@ -210,7 +210,7 @@ int main(int argc, char *argv[])
} else if (mode == 5) {
printf("Test thumbnail_request_extract_all_thumbs\n");
- err = thumbnail_request_extract_all_thumbs();
+ err = thumbnail_request_extract_all_thumbs(tzplatform_getuid(TZ_USER_NAME));
if (err < 0) {
printf("thumbnail_request_extract_all_thumbs failed : %d\n", err);
return -1;
@@ -220,7 +220,7 @@ int main(int argc, char *argv[])
} else if (mode == 6) {
printf("Test thumbnail_request_cancel_media\n");
- err = thumbnail_request_cancel_media(origin_path);
+ err = thumbnail_request_cancel_media(origin_path,tzplatform_getuid(TZ_USER_NAME));
if (err < 0) {
printf("thumbnail_request_cancel_media failed : %d\n", err);
return -1;