dump layer buffer when calling tdm_layer_set_buffer
[platform/core/uifw/libtdm.git] / src / tdm_server.c
index 5d7159a..3ade1e5 100644 (file)
@@ -791,8 +791,7 @@ static void
 _tdm_socket_init(tdm_private_loop *private_loop)
 {
        const char *dir = NULL;
-       char socket_path[128];
-       int size;
+       char socket_path[TDM_NAME_LEN * 2];
        int ret = -1;
        uid_t uid;
        gid_t gid;
@@ -803,11 +802,11 @@ _tdm_socket_init(tdm_private_loop *private_loop)
                return;
        }
 
-       size = snprintf(socket_path, sizeof(socket_path), "%s/%s", dir, "tdm-socket");
-       if (size >= (int)sizeof(socket_path)) {
-               TDM_WRN("too long: %s/tdm-socket", dir);
-               return;
-       };
+       strncpy(socket_path, dir, TDM_NAME_LEN - 1);
+       socket_path[TDM_NAME_LEN - 1] = '\0';
+
+       strncat(socket_path, "/tdm-socket", 11);
+       socket_path[TDM_NAME_LEN + 10] = '\0';
 
        ret = chmod(socket_path, 509);
        if (ret < 0) {