Permalink
Browse files

Revert "Fix logging macros in su source"

This reverts commit dfbe581.
  • Loading branch information...
1 parent 6fd5133 commit 91d64367c5fa221ede9715c990f8bea02956714c @cyanogen cyanogen committed Aug 10, 2012
Showing with 21 additions and 21 deletions.
  1. +4 −4 db.c
  2. +9 −9 su.c
  3. +8 −8 su.h
View
@@ -28,21 +28,21 @@ int database_check(const struct su_context *ctx)
char *filename = malloc(snprintf(NULL, 0, "%s/%u-%u", REQUESTOR_STORED_PATH, ctx->from.uid, ctx->to.uid) + 1);
sprintf(filename, "%s/%u-%u", REQUESTOR_STORED_PATH, ctx->from.uid, ctx->to.uid);
if ((fp = fopen(filename, "r"))) {
- ALOGD("Found file");
+ LOGD("Found file");
char cmd[PATH_MAX];
fgets(cmd, sizeof(cmd), fp);
int last = strlen(cmd) - 1;
- ALOGD("this is the last character %u of the string", cmd[5]);
+ LOGD("this is the last character %u of the string", cmd[5]);
if (cmd[last] == '\n') {
cmd[last] = '\0';
}
- ALOGD("Comparing %c %s, %u to %s", cmd[last - 2], cmd, last, get_command(&ctx->to));
+ LOGD("Comparing %c %s, %u to %s", cmd[last - 2], cmd, last, get_command(&ctx->to));
if (strcmp(cmd, get_command(&ctx->to)) == 0) {
allow = fgetc(fp);
}
fclose(fp);
} else if ((fp = fopen(REQUESTOR_STORED_DEFAULT, "r"))) {
- ALOGD("Using default");
+ LOGD("Using default");
allow = fgetc(fp);
fclose(fp);
}
View
@@ -284,7 +284,7 @@ static void deny(const struct su_context *ctx)
char *cmd = get_command(&ctx->to);
send_intent(ctx, "", 0, ACTION_RESULT);
- ALOGW("request rejected (%u->%u %s)", ctx->from.uid, ctx->to.uid, cmd);
+ LOGW("request rejected (%u->%u %s)", ctx->from.uid, ctx->to.uid, cmd);
fprintf(stderr, "%s\n", strerror(EACCES));
exit(EXIT_FAILURE);
}
@@ -335,7 +335,7 @@ static void allow(const struct su_context *ctx)
(ctx->to.optind + (arg) < ctx->to.argc) ? " " : "", \
(ctx->to.optind + (arg) < ctx->to.argc) ? ctx->to.argv[ctx->to.optind + (arg)] : ""
- ALOGD("%u %s executing %u %s using shell %s : %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+ LOGD("%u %s executing %u %s using shell %s : %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
ctx->from.uid, ctx->from.bin,
ctx->to.uid, get_command(&ctx->to), ctx->to.shell,
arg0, PARG(0), PARG(1), PARG(2), PARG(3), PARG(4), PARG(5),
@@ -437,7 +437,7 @@ int main(int argc, char *argv[])
errno = 0;
ctx.to.uid = strtoul(argv[optind], &endptr, 10);
if (errno || *endptr) {
- ALOGE("Unknown id: %s\n", argv[optind]);
+ LOGE("Unknown id: %s\n", argv[optind]);
fprintf(stderr, "Unknown id: %s\n", argv[optind]);
exit(EXIT_FAILURE);
}
@@ -483,20 +483,20 @@ int main(int argc, char *argv[])
if (strlen(cm_version) > 0) {
// only allow su on debuggable builds
if (strcmp("1", debuggable) != 0) {
- ALOGE("Root access is disabled on non-debug builds");
+ LOGE("Root access is disabled on non-debug builds");
deny(&ctx);
}
// enforce persist.sys.root_access on non-eng builds
if (strcmp("eng", build_type) != 0 &&
(atoi(enabled) & 1) != 1 ) {
- ALOGE("Root access is disabled by system setting - enable it under settings -> developer options");
+ LOGE("Root access is disabled by system setting - enable it under settings -> developer options");
deny(&ctx);
}
// disallow su in a shell if appropriate
if (ctx.from.uid == AID_SHELL && (atoi(enabled) == 1)) {
- ALOGE("Root access is disabled by a system setting - enable it under settings -> developer options");
+ LOGE("Root access is disabled by a system setting - enable it under settings -> developer options");
deny(&ctx);
}
}
@@ -511,7 +511,7 @@ int main(int argc, char *argv[])
if (st.st_gid != st.st_uid)
{
- ALOGE("Bad uid/gid %d/%d for Superuser Requestor application",
+ LOGE("Bad uid/gid %d/%d for Superuser Requestor application",
(int)st.st_uid, (int)st.st_gid);
deny(&ctx);
}
@@ -579,7 +579,7 @@ int main(int argc, char *argv[])
#define SOCKET_RESPONSE "socket:"
if (strncmp(result, SOCKET_RESPONSE, sizeof(SOCKET_RESPONSE) - 1))
- ALOGW("SECURITY RISK: Requestor still receives credentials in intent");
+ LOGW("SECURITY RISK: Requestor still receives credentials in intent");
else
result += sizeof(SOCKET_RESPONSE) - 1;
@@ -588,7 +588,7 @@ int main(int argc, char *argv[])
} else if (!strcmp(result, "ALLOW")) {
allow(&ctx);
} else {
- ALOGE("unknown response from Superuser Requestor: %s", result);
+ LOGE("unknown response from Superuser Requestor: %s", result);
deny(&ctx);
}
View
@@ -89,15 +89,15 @@ static inline char *get_command(const struct su_request *to)
}
#if 0
-#undef ALOGE
-#define ALOGE(fmt,args...) fprintf(stderr, fmt, ##args)
-#undef ALOGD
-#define ALOGD(fmt,args...) fprintf(stderr, fmt, ##args)
-#undef ALOGW
-#define ALOGW(fmt,args...) fprintf(stderr, fmt, ##args)
+#undef LOGE
+#define LOGE(fmt,args...) fprintf(stderr, fmt, ##args)
+#undef LOGD
+#define LOGD(fmt,args...) fprintf(stderr, fmt, ##args)
+#undef LOGW
+#define LOGW(fmt,args...) fprintf(stderr, fmt, ##args)
#endif
-#define PLOGE(fmt,args...) ALOGE(fmt " failed with %d: %s", ##args, errno, strerror(errno))
-#define PLOGEV(fmt,err,args...) ALOGE(fmt " failed with %d: %s", ##args, err, strerror(err))
+#define PLOGE(fmt,args...) LOGE(fmt " failed with %d: %s", ##args, errno, strerror(errno))
+#define PLOGEV(fmt,err,args...) LOGE(fmt " failed with %d: %s", ##args, err, strerror(err))
#endif

0 comments on commit 91d6436

Please sign in to comment.