remove hardcoded path for multiuser support
[platform/core/api/usb-accessory.git] / src / usb_accessory_private.c
index 2f2611b..4b51739 100644 (file)
@@ -17,6 +17,8 @@
 
 #include "usb_accessory_private.h"
 
+#include <tzplatform_config.h>
+
 #define NUM_ACC_INFO_SEPARATOR 5
 
 static void show_acc_info(struct usb_accessory_s *accessory)
@@ -234,9 +236,9 @@ int ipc_noti_client_init(void)
                return -1;
        }
 
-       ret = chown(ACC_SOCK_PATH, 5000, 5000);
+       ret = chown(ACC_SOCK_PATH,tzplatform_getuid(TZ_USER_NAME),tzplatform_getgid(TZ_SYS_USER_GROUP));
        if (ret < 0) {
-               USB_LOG("FAIL: chown(ACC_SOCK_PATH, 5000, 5000)");
+               USB_LOG("FAIL: chown(ACC_SOCK_PATH, tzplatform_getuid(TZ_USER_NAME),tzplatform_getgid(TZ_SYS_USER_GROUP))");
                close(sock_local);
                return -1;
        }
@@ -287,7 +289,7 @@ gboolean ipc_noti_client_cb(GIOChannel *gioCh, GIOCondition condition, gpointer
        sockfd = accept(fd, (struct sockaddr *)&clientaddr, (socklen_t *)&clientlen);
        if (sockfd == -1) {
                USB_LOG("FAIL: accept()");
-               goto out_ipc_fd;
+               goto out_gio_unref;
        }
 
        if(read_message(sockfd, inbuf, sizeof(inbuf)) < 0) {