1. Undo some changes about running scripts.
2. Move android logging from logit() to log_write().
3. Remove all syslog() related calls.
#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"
}
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);
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;
argv[6] = ipparam;
argv[7] = NULL;
ipcp_script_pid = run_program(script, argv, 0, ipcp_script_done, NULL);
-#endif
}
/*
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);
void
reopen_log()
{
+#ifndef ANDROID_CHANGES
openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
setlogmask(LOG_UPTO(LOG_INFO));
+#endif
}
/*
if (errfd != 2)
dup2(errfd, 2);
+#ifndef ANDROID_CHANGES
closelog();
+#endif
if (log_to_fd > 2)
close(log_to_fd);
if (the_channel->close)
/* 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);
}
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
}
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
#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);
|| write(log_to_fd, "\n", 1) != 1)
log_to_fd = -1;
}
+#else
+ __android_log_write(syslog_to_android[level], LOG_TAG, buf);
+#endif
}
/*