init: Move property_set_fd to property_service.c

Change-Id: Ic7a19073eae8f353d48cabee80fa9722b35a82b5
diff --git a/init/property_service.c b/init/property_service.c
index d2505dd..28160f8 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -48,6 +48,8 @@
 
 static int persistent_properties_loaded = 0;
 
+static int property_set_fd = -1;
+
 /* White list of permissions for setting property services. */
 struct {
     const char *prefix;
@@ -187,7 +189,7 @@
  *
  * Returns 1 if uid allowed, 0 otherwise.
  */
-static int check_control_perms(const char *name, int uid, int gid) {
+static int check_control_perms(const char *name, unsigned int uid, unsigned int gid) {
     int i;
     if (uid == AID_SYSTEM || uid == AID_ROOT)
         return 1;
@@ -208,7 +210,7 @@
  * Checks permissions for setting system properties.
  * Returns 1 if uid allowed, 0 otherwise.
  */
-static int check_perms(const char *name, unsigned int uid, int gid)
+static int check_perms(const char *name, unsigned int uid, unsigned int gid)
 {
     int i;
     if (uid == 0)
@@ -344,7 +346,7 @@
     return 0;
 }
 
-void handle_property_set_fd(int fd)
+void handle_property_set_fd()
 {
     prop_msg msg;
     int s;
@@ -355,7 +357,7 @@
     socklen_t addr_size = sizeof(addr);
     socklen_t cr_size = sizeof(cr);
 
-    if ((s = accept(fd, (struct sockaddr *) &addr, &addr_size)) < 0) {
+    if ((s = accept(property_set_fd, (struct sockaddr *) &addr, &addr_size)) < 0) {
         return;
     }
 
@@ -493,7 +495,7 @@
     load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT);
 }
 
-int start_property_service(void)
+void start_property_service(void)
 {
     int fd;
 
@@ -504,10 +506,15 @@
     load_persistent_properties();
 
     fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM, 0666, 0, 0);
-    if(fd < 0) return -1;
+    if(fd < 0) return;
     fcntl(fd, F_SETFD, FD_CLOEXEC);
     fcntl(fd, F_SETFL, O_NONBLOCK);
 
     listen(fd, 8);
-    return fd;
+    property_set_fd = fd;
+}
+
+int get_property_set_fd()
+{
+    return property_set_fd;
 }