Merge "init.rc: add healthd to system group to allow write to /dev/cpuset" into mnc-dev
diff --git a/libsysutils/src/NetlinkEvent.cpp b/libsysutils/src/NetlinkEvent.cpp
index 2347028..23dcd62 100644
--- a/libsysutils/src/NetlinkEvent.cpp
+++ b/libsysutils/src/NetlinkEvent.cpp
@@ -463,19 +463,19 @@
// Construct "SERVERS=<comma-separated string of DNS addresses>".
static const char kServerTag[] = "SERVERS=";
- static const int kTagLength = strlen(kServerTag);
+ static const size_t kTagLength = strlen(kServerTag);
// Reserve sufficient space for an IPv6 link-local address: all but the
// last address are followed by ','; the last is followed by '\0'.
- static const int kMaxSingleAddressLength =
+ static const size_t kMaxSingleAddressLength =
INET6_ADDRSTRLEN + strlen("%") + IFNAMSIZ + strlen(",");
- const int bufsize = kTagLength + numaddrs * (INET6_ADDRSTRLEN + 1);
+ const size_t bufsize = kTagLength + numaddrs * kMaxSingleAddressLength;
char *buf = (char *) malloc(bufsize);
if (!buf) {
SLOGE("RDNSS option: out of memory\n");
return false;
}
strcpy(buf, kServerTag);
- int pos = kTagLength;
+ size_t pos = kTagLength;
struct in6_addr *addrs = (struct in6_addr *) (rndss_opt + 1);
for (int i = 0; i < numaddrs; i++) {
diff --git a/logd/main.cpp b/logd/main.cpp
index 9b88983..a3241d0 100644
--- a/logd/main.cpp
+++ b/logd/main.cpp
@@ -103,6 +103,10 @@
return -1;
}
+ if (setgroups(0, NULL) == -1) {
+ return -1;
+ }
+
if (setgid(AID_LOGD) != 0) {
return -1;
}
diff --git a/rootdir/init.rc b/rootdir/init.rc
index b7e238a..9019b1f 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -145,9 +145,9 @@
chown system system /dev/cpuset/tasks
chown system system /dev/cpuset/foreground/tasks
chown system system /dev/cpuset/background/tasks
- chmod 0644 /dev/cpuset/foreground/tasks
- chmod 0644 /dev/cpuset/background/tasks
- chmod 0644 /dev/cpuset/tasks
+ chmod 0664 /dev/cpuset/foreground/tasks
+ chmod 0664 /dev/cpuset/background/tasks
+ chmod 0664 /dev/cpuset/tasks
# qtaguid will limit access to specific data based on group memberships.
@@ -523,6 +523,7 @@
socket logd stream 0666 logd logd
socket logdr seqpacket 0666 logd logd
socket logdw dgram 0222 logd logd
+ group root system
service logd-reinit /system/bin/logd --reinit
oneshot