logd: specify clang format
Switch _all_ file's coding style to match to ease all future changes.
SideEffects: None
Test: compile
Bug: 35373582
Change-Id: I470cb17f64fa48f14aafc02f574e296bffe3a3f3
diff --git a/logd/LogCommand.cpp b/logd/LogCommand.cpp
index 3b17576..6d7c0a5 100644
--- a/logd/LogCommand.cpp
+++ b/logd/LogCommand.cpp
@@ -24,7 +24,7 @@
#include "LogCommand.h"
#include "LogUtils.h"
-LogCommand::LogCommand(const char *cmd) : FrameworkCommand(cmd) {
+LogCommand::LogCommand(const char* cmd) : FrameworkCommand(cmd) {
}
// gets a list of supplementary group IDs associated with
@@ -40,8 +40,8 @@
// has open permissions, and one that has restricted
// permissions.
-static bool groupIsLog(char *buf) {
- char *ptr;
+static bool groupIsLog(char* buf) {
+ char* ptr;
static const char ws[] = " \n";
for (buf = strtok_r(buf, ws, &ptr); buf; buf = strtok_r(NULL, ws, &ptr)) {
@@ -91,15 +91,14 @@
// doubt, but we expect the falses should be reduced significantly as
// three times is a charm.
//
- for (int retry = 3;
- !(ret = foundGid && foundUid && foundLog) && retry;
- --retry) {
- FILE *file = fopen(filename, "r");
+ for (int retry = 3; !(ret = foundGid && foundUid && foundLog) && retry;
+ --retry) {
+ FILE* file = fopen(filename, "r");
if (!file) {
continue;
}
- char *line = NULL;
+ char* line = NULL;
size_t len = 0;
while (getline(&line, &len, file) > 0) {
static const char groups_string[] = "Groups:\t";
@@ -111,29 +110,25 @@
foundLog = true;
}
} else if (strncmp(uid_string, line, sizeof(uid_string) - 1) == 0) {
- uid_t u[4] = { (uid_t) -1, (uid_t) -1, (uid_t) -1, (uid_t) -1};
+ uid_t u[4] = { (uid_t)-1, (uid_t)-1, (uid_t)-1, (uid_t)-1 };
- sscanf(line + sizeof(uid_string) - 1, "%u\t%u\t%u\t%u",
- &u[0], &u[1], &u[2], &u[3]);
+ sscanf(line + sizeof(uid_string) - 1, "%u\t%u\t%u\t%u", &u[0],
+ &u[1], &u[2], &u[3]);
// Protect against PID reuse by checking that UID is the same
- if ((uid == u[0])
- && (uid == u[1])
- && (uid == u[2])
- && (uid == u[3])) {
+ if ((uid == u[0]) && (uid == u[1]) && (uid == u[2]) &&
+ (uid == u[3])) {
foundUid = true;
}
} else if (strncmp(gid_string, line, sizeof(gid_string) - 1) == 0) {
- gid_t g[4] = { (gid_t) -1, (gid_t) -1, (gid_t) -1, (gid_t) -1};
+ gid_t g[4] = { (gid_t)-1, (gid_t)-1, (gid_t)-1, (gid_t)-1 };
- sscanf(line + sizeof(gid_string) - 1, "%u\t%u\t%u\t%u",
- &g[0], &g[1], &g[2], &g[3]);
+ sscanf(line + sizeof(gid_string) - 1, "%u\t%u\t%u\t%u", &g[0],
+ &g[1], &g[2], &g[3]);
// Protect against PID reuse by checking that GID is the same
- if ((gid == g[0])
- && (gid == g[1])
- && (gid == g[2])
- && (gid == g[3])) {
+ if ((gid == g[0]) && (gid == g[1]) && (gid == g[2]) &&
+ (gid == g[3])) {
foundGid = true;
}
}
@@ -145,6 +140,6 @@
return ret;
}
-bool clientHasLogCredentials(SocketClient *cli) {
+bool clientHasLogCredentials(SocketClient* cli) {
return clientHasLogCredentials(cli->getUid(), cli->getGid(), cli->getPid());
}