Merge "logwrap: fix off by 1 argument error"

This commit is contained in:
Rom Lemarchand 2013-01-28 23:23:40 +00:00 committed by Android (Google) Code Review
commit e74313baf8
2 changed files with 3 additions and 3 deletions

View file

@ -227,7 +227,7 @@ int logwrap(int argc, char* argv[], int *status) {
dup2(child_ptty, 2);
close(child_ptty);
child(argc - 1, &argv[1]);
child(argc, argv);
fatal("This should never happen\n");
return -1;
} else {
@ -268,7 +268,7 @@ int logwrap(int argc, char* argv[], int *status) {
setgid(AID_LOG);
setuid(AID_LOG);
rc = parent(argv[1], parent_ptty, sockets[1], pid, status);
rc = parent(argv[0], parent_ptty, sockets[1], pid, status);
}
close(sockets[0]);

View file

@ -59,7 +59,7 @@ int main(int argc, char* argv[]) {
usage();
}
rc = logwrap(argc, argv, &status);
rc = logwrap(argc - 1, &argv[1], &status);
if (!rc) {
if (WIFEXITED(status))
rc = WEXITSTATUS(status);