[FIX] smack access to screenshots 90/29990/3 Tizen_SDK_2.3
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Thu, 6 Nov 2014 15:50:19 +0000 (18:50 +0300)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 6 Nov 2014 16:40:01 +0000 (08:40 -0800)
Change-Id: Ife047b0ad8ea87ee63a49a52d8ac31f226b3b2b1
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
helper/dacapture.c
include/binproto.h

index d6cd076..29aa622 100755 (executable)
@@ -360,11 +360,25 @@ int captureScreen()
                                {
                                        chmod(dstpath, 0777);
 
-                                       PREPARE_LOCAL_BUF();
+                                       /* welcome to the hell */
+                                       log_t log;
+                                       PREPARE_LOCAL_BUF_THOUGH((char *)&log);
+
+                                       /* skip header */
+                                       LOCAL_BUF += offsetof(log_t, data);
+                                       /* pack screenshot name */
+                                       BUF_PTR = pack_string(LOCAL_BUF, dstpath); /* file name */
+                                       LOCAL_BUF = BUF_PTR;
+
+                                       /* pack probe */
                                        PACK_COMMON_BEGIN(MSG_PROBE_SCREENSHOT, API_ID_captureScreen, "", 0);
                                        PACK_COMMON_END('d', 0, 0, 0);
                                        PACK_SCREENSHOT(dstpath, getOrientation());
-                                       FLUSH_LOCAL_BUF();
+                                       SET_MSG_LEN();
+                                       log.length = GET_MSG_LEN() + MSG_LEN_OFFSET + strlen(dstpath) + 1;
+
+                                       /* send all message */
+                                       printLog(&log, MSG_IMAGE);
                                }
                                else
                                {
index 99fda6d..30db24c 100644 (file)
@@ -491,10 +491,22 @@ static char __attribute__((used)) *pack_ret(char *to, char ret_type, ...)
                char *BUF_PTR = LOCAL_BUF;                      \
                char *RET_PTR = NULL
 
+#define PREPARE_LOCAL_BUF_THOUGH(BUFF)                         \
+               char *LOCAL_BUF = BUFF;                         \
+               char *BUF_PTR = LOCAL_BUF;                      \
+               char *RET_PTR = NULL
+
 #define MSG_LEN_OFFSET 16
 #define MSG_HDR_LEN 20
+
+#define SET_MSG_LEN()                                                  \
+               *(uint32_t *)(msg_buf + MSG_LEN_OFFSET) = (p - msg_buf) - MSG_HDR_LEN;
+
+#define GET_MSG_LEN()                                                  \
+               (p - msg_buf) - MSG_HDR_LEN
+
 #define FLUSH_LOCAL_BUF()                                              \
-               *(uint32_t *)(msg_buf + MSG_LEN_OFFSET) = (p - msg_buf) - MSG_HDR_LEN; \
+               SET_MSG_LEN();                                          \
                send(gTraceInfo.socket.daemonSock, msg_buf, (p - msg_buf), 0); \
                free(LOCAL_BUF);                                        \
                LOCAL_BUF = NULL