summaryrefslogtreecommitdiffstats
path: root/logwrapper
diff options
context:
space:
mode:
authorRom Lemarchand <romlem@google.com>2013-01-03 14:37:57 -0800
committerRom Lemarchand <romlem@google.com>2013-01-03 14:42:05 -0800
commit4d74bcf4458c4b2c902a3d4f45afbd51f5a3be1e (patch)
treec12afd1d4b54676a3d51d2d65a9bfe3b947d863f /logwrapper
parent2bf496378dbaabe3a49915574b11b1c74032b34a (diff)
downloadsystem_core-4d74bcf4458c4b2c902a3d4f45afbd51f5a3be1e.zip
system_core-4d74bcf4458c4b2c902a3d4f45afbd51f5a3be1e.tar.gz
system_core-4d74bcf4458c4b2c902a3d4f45afbd51f5a3be1e.tar.bz2
Remove -d option from logwrapper
Removing the ability of logwrapper to die with a SIGSEGV at address "return code from wait". Change-Id: I563715db2b1e5e789af84190fc2ff78664d63572
Diffstat (limited to 'logwrapper')
-rw-r--r--logwrapper/logwrapper.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/logwrapper/logwrapper.c b/logwrapper/logwrapper.c
index dd777c0..3b876d4 100644
--- a/logwrapper/logwrapper.c
+++ b/logwrapper/logwrapper.c
@@ -35,17 +35,14 @@ void fatal(const char *msg) {
void usage() {
fatal(
- "Usage: logwrapper [-d] BINARY [ARGS ...]\n"
+ "Usage: logwrapper BINARY [ARGS ...]\n"
"\n"
"Forks and executes BINARY ARGS, redirecting stdout and stderr to\n"
"the Android logging system. Tag is set to BINARY, priority is\n"
- "always LOG_INFO.\n"
- "\n"
- "-d: Causes logwrapper to SIGSEGV when BINARY terminates\n"
- " fault address is set to the status of wait()\n");
+ "always LOG_INFO.\n");
}
-void parent(const char *tag, int seg_fault_on_exit, int parent_read) {
+void parent(const char *tag, int parent_read) {
int status;
char buffer[4096];
@@ -105,8 +102,6 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) {
} else
ALOG(LOG_INFO, "logwrapper", "%s wait() failed: %s (%d)", tag,
strerror(errno), errno);
- if (seg_fault_on_exit)
- *(int *)status = 0; // causes SIGSEGV with fault_address = status
}
void child(int argc, char* argv[]) {
@@ -124,7 +119,6 @@ void child(int argc, char* argv[]) {
int main(int argc, char* argv[]) {
pid_t pid;
- int seg_fault_on_exit = 0;
int parent_ptty;
int child_ptty;
@@ -134,16 +128,6 @@ int main(int argc, char* argv[]) {
usage();
}
- if (strncmp(argv[1], "-d", 2) == 0) {
- seg_fault_on_exit = 1;
- argc--;
- argv++;
- }
-
- if (argc < 2) {
- usage();
- }
-
/* Use ptty instead of socketpair so that STDOUT is not buffered */
parent_ptty = open("/dev/ptmx", O_RDWR);
if (parent_ptty < 0) {
@@ -179,7 +163,7 @@ int main(int argc, char* argv[]) {
setgid(AID_LOG);
setuid(AID_LOG);
- parent(argv[1], seg_fault_on_exit, parent_ptty);
+ parent(argv[1], parent_ptty);
}
return 0;