summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2009-06-18 19:48:16 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-18 19:48:16 -0700
commita409feacc2c3c4d1a8e3d1c1ed2ddb3f872805e4 (patch)
tree003672e8a26a61b891e4a67e8af3e2304598229e
parent69a772cf3b56f1eda3d95e60f69472eede937576 (diff)
parent821c6079634ae728eda7a19e947a2c8f0dd1fdaa (diff)
downloadppp-a409feacc2c3c4d1a8e3d1c1ed2ddb3f872805e4.tar.gz
am 821c6079: Fix few minor things in pppd.
Merge commit '821c6079634ae728eda7a19e947a2c8f0dd1fdaa' * commit '821c6079634ae728eda7a19e947a2c8f0dd1fdaa': Fix few minor things in pppd.
-rw-r--r--pppd/ipcp.c17
-rw-r--r--pppd/main.c8
-rw-r--r--pppd/options.c3
-rw-r--r--pppd/utils.c40
4 files changed, 30 insertions, 38 deletions
diff --git a/pppd/ipcp.c b/pppd/ipcp.c
index b5b5c82..09aebe3 100644
--- a/pppd/ipcp.c
+++ b/pppd/ipcp.c
@@ -55,9 +55,6 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#ifdef ANDROID_CHANGES
-#include <paths.h>
-#endif
#include "pppd.h"
#include "fsm.h"
@@ -1715,10 +1712,6 @@ ipcp_up(f)
}
script_setenv("IPLOCAL", ip_ntoa(go->ouraddr), 0);
script_setenv("IPREMOTE", ip_ntoa(ho->hisaddr), 1);
-#ifdef ANDROID_CHANGES
- script_setenv("PATH","/sbin:/system/sbin:/system/bin:/system/xbin", 0);
- script_setenv("ANDROID_PROPERTY_WORKSPACE", getenv("ANDROID_PROPERTY_WORKSPACE"), 0);
-#endif
if (go->dnsaddr[0])
script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0);
@@ -1985,13 +1978,6 @@ ipcp_script(script)
slprintf(strlocal, sizeof(strlocal), "%I", ipcp_gotoptions[0].ouraddr);
slprintf(strremote, sizeof(strremote), "%I", ipcp_hisoptions[0].hisaddr);
-#ifdef ANDROID_CHANGES
- argv[0] = "sh";
- argv[1] = "-c";
- argv[2] = script;
- argv[3] = NULL;
- ipcp_script_pid = run_program(_PATH_BSHELL, argv, 0, ipcp_script_done, NULL);
-#else
argv[0] = script;
argv[1] = ifname;
argv[2] = devnam;
@@ -2001,7 +1987,6 @@ ipcp_script(script)
argv[6] = ipparam;
argv[7] = NULL;
ipcp_script_pid = run_program(script, argv, 0, ipcp_script_done, NULL);
-#endif
}
/*
@@ -2011,9 +1996,9 @@ static void
create_resolv(peerdns1, peerdns2)
u_int32_t peerdns1, peerdns2;
{
+#ifndef ANDROID_CHANGES
FILE *f;
-#if 0 /* resolv.conf has no meaning for ANDROIDS */
f = fopen(_PATH_RESOLV, "w");
if (f == NULL) {
error("Failed to create %s: %m", _PATH_RESOLV);
diff --git a/pppd/main.c b/pppd/main.c
index 162208f..8515c1e 100644
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -812,8 +812,10 @@ detach()
void
reopen_log()
{
+#ifndef ANDROID_CHANGES
openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
setlogmask(LOG_UPTO(LOG_INFO));
+#endif
}
/*
@@ -1525,7 +1527,9 @@ safe_fork(int infd, int outfd, int errfd)
if (errfd != 2)
dup2(errfd, 2);
+#ifndef ANDROID_CHANGES
closelog();
+#endif
if (log_to_fd > 2)
close(log_to_fd);
if (the_channel->close)
@@ -1674,11 +1678,15 @@ run_program(prog, args, must_exist, done, arg)
/* run the program */
execve(prog, args, script_env);
if (must_exist || errno != ENOENT) {
+#ifndef ANDROID_CHANGES
/* have to reopen the log, there's nowhere else
for the message to go. */
reopen_log();
syslog(LOG_ERR, "Can't execute %s: %m", prog);
closelog();
+#else
+ error("Can't execute %s: %m", prog);
+#endif
}
_exit(-1);
}
diff --git a/pppd/options.c b/pppd/options.c
index 5375bf3..f8a836b 100644
--- a/pppd/options.c
+++ b/pppd/options.c
@@ -1065,8 +1065,9 @@ option_error __V((char *fmt, ...))
va_end(args);
if (phase == PHASE_INITIALIZE)
fprintf(stderr, "%s: %s\n", progname, buf);
+#ifndef ANDROID_CHANGES
syslog(LOG_ERR, "%s", buf);
-#ifdef ANDROID_CHANGES
+#else
error("%s", buf);
#endif
}
diff --git a/pppd/utils.c b/pppd/utils.c
index 781044f..1ef4b3b 100644
--- a/pppd/utils.c
+++ b/pppd/utils.c
@@ -649,6 +649,21 @@ print_string(p, len, printer, arg)
printer(arg, "\"");
}
+/*
+ * logit - does the hard work for fatal et al.
+ */
+static void
+logit(level, fmt, args)
+ int level;
+ char *fmt;
+ va_list args;
+{
+ int n;
+ char buf[1024];
+
+ n = vslprintf(buf, sizeof(buf), fmt, args);
+ log_write(level, buf);
+}
#ifdef ANDROID_CHANGES
@@ -669,32 +684,12 @@ static int syslog_to_android[] = {
#endif
-/*
- * logit - does the hard work for fatal et al.
- */
-static void
-logit(level, fmt, args)
- int level;
- char *fmt;
- va_list args;
-{
- int n;
- char buf[1024];
-
- n = vslprintf(buf, sizeof(buf), fmt, args);
-
-#ifndef ANDROID_CHANGES
- log_write(level, buf);
-#else
- __android_log_write(syslog_to_android[level], LOG_TAG, buf);
-#endif
-}
-
static void
log_write(level, buf)
int level;
char *buf;
{
+#ifndef ANDROID_CHANGES
syslog(level, "%s", buf);
fprintf(stderr, buf);
@@ -708,6 +703,9 @@ log_write(level, buf)
|| write(log_to_fd, "\n", 1) != 1)
log_to_fd = -1;
}
+#else
+ __android_log_write(syslog_to_android[level], LOG_TAG, buf);
+#endif
}
/*