server: skip chown if not a super user 43/131243/1
authorBoram Park <boram1288.park@samsung.com>
Fri, 26 May 2017 04:08:34 +0000 (13:08 +0900)
committerBoram Park <boram1288.park@samsung.com>
Fri, 26 May 2017 04:08:47 +0000 (13:08 +0900)
If tdm_display_init is called by non super user, we don't need to
change the owner and group of a tdm socket file. And also changing
the owner of the tdm socket file which is created by non super user
is not allowed. So we just skip chown in this case.

Change-Id: Ib119becc4b9048f0fcc79c52089cfe04907cac60

src/tdm_server.c

index 9363768..209429b 100644 (file)
@@ -705,6 +705,10 @@ _tdm_socket_init(tdm_private_loop *private_loop)
                return 0;
        }
 
+       /* if not super user, we don't need to change owner and group */
+       if (getuid() != 0)
+               return 1;
+
        ret = _tdm_getgrnam_r("root");
        if (ret < 0) {
                TDM_ERR("getting uid failed");