• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

external/ppp


Commit MetaInfo

Revision821c6079634ae728eda7a19e947a2c8f0dd1fdaa (tree)
Zeit2009-06-16 19:19:44
AutorChia-chi Yeh <chiachi@andr...>
CommiterChia-chi Yeh

Log Message

Fix few minor things in pppd.

1. Undo some changes about running scripts.
2. Move android logging from logit() to log_write().
3. Remove all syslog() related calls.

Ändern Zusammenfassung

Diff

--- a/pppd/ipcp.c
+++ b/pppd/ipcp.c
@@ -55,9 +55,6 @@
5555 #include <sys/socket.h>
5656 #include <netinet/in.h>
5757 #include <arpa/inet.h>
58-#ifdef ANDROID_CHANGES
59-#include <paths.h>
60-#endif
6158
6259 #include "pppd.h"
6360 #include "fsm.h"
@@ -1715,10 +1712,6 @@ ipcp_up(f)
17151712 }
17161713 script_setenv("IPLOCAL", ip_ntoa(go->ouraddr), 0);
17171714 script_setenv("IPREMOTE", ip_ntoa(ho->hisaddr), 1);
1718-#ifdef ANDROID_CHANGES
1719- script_setenv("PATH","/sbin:/system/sbin:/system/bin:/system/xbin", 0);
1720- script_setenv("ANDROID_PROPERTY_WORKSPACE", getenv("ANDROID_PROPERTY_WORKSPACE"), 0);
1721-#endif
17221715
17231716 if (go->dnsaddr[0])
17241717 script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0);
@@ -1985,13 +1978,6 @@ ipcp_script(script)
19851978 slprintf(strlocal, sizeof(strlocal), "%I", ipcp_gotoptions[0].ouraddr);
19861979 slprintf(strremote, sizeof(strremote), "%I", ipcp_hisoptions[0].hisaddr);
19871980
1988-#ifdef ANDROID_CHANGES
1989- argv[0] = "sh";
1990- argv[1] = "-c";
1991- argv[2] = script;
1992- argv[3] = NULL;
1993- ipcp_script_pid = run_program(_PATH_BSHELL, argv, 0, ipcp_script_done, NULL);
1994-#else
19951981 argv[0] = script;
19961982 argv[1] = ifname;
19971983 argv[2] = devnam;
@@ -2001,7 +1987,6 @@ ipcp_script(script)
20011987 argv[6] = ipparam;
20021988 argv[7] = NULL;
20031989 ipcp_script_pid = run_program(script, argv, 0, ipcp_script_done, NULL);
2004-#endif
20051990 }
20061991
20071992 /*
@@ -2011,9 +1996,9 @@ static void
20111996 create_resolv(peerdns1, peerdns2)
20121997 u_int32_t peerdns1, peerdns2;
20131998 {
1999+#ifndef ANDROID_CHANGES
20142000 FILE *f;
20152001
2016-#if 0 /* resolv.conf has no meaning for ANDROIDS */
20172002 f = fopen(_PATH_RESOLV, "w");
20182003 if (f == NULL) {
20192004 error("Failed to create %s: %m", _PATH_RESOLV);
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -812,8 +812,10 @@ detach()
812812 void
813813 reopen_log()
814814 {
815+#ifndef ANDROID_CHANGES
815816 openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
816817 setlogmask(LOG_UPTO(LOG_INFO));
818+#endif
817819 }
818820
819821 /*
@@ -1525,7 +1527,9 @@ safe_fork(int infd, int outfd, int errfd)
15251527 if (errfd != 2)
15261528 dup2(errfd, 2);
15271529
1530+#ifndef ANDROID_CHANGES
15281531 closelog();
1532+#endif
15291533 if (log_to_fd > 2)
15301534 close(log_to_fd);
15311535 if (the_channel->close)
@@ -1674,11 +1678,15 @@ run_program(prog, args, must_exist, done, arg)
16741678 /* run the program */
16751679 execve(prog, args, script_env);
16761680 if (must_exist || errno != ENOENT) {
1681+#ifndef ANDROID_CHANGES
16771682 /* have to reopen the log, there's nowhere else
16781683 for the message to go. */
16791684 reopen_log();
16801685 syslog(LOG_ERR, "Can't execute %s: %m", prog);
16811686 closelog();
1687+#else
1688+ error("Can't execute %s: %m", prog);
1689+#endif
16821690 }
16831691 _exit(-1);
16841692 }
--- a/pppd/options.c
+++ b/pppd/options.c
@@ -1065,8 +1065,9 @@ option_error __V((char *fmt, ...))
10651065 va_end(args);
10661066 if (phase == PHASE_INITIALIZE)
10671067 fprintf(stderr, "%s: %s\n", progname, buf);
1068+#ifndef ANDROID_CHANGES
10681069 syslog(LOG_ERR, "%s", buf);
1069-#ifdef ANDROID_CHANGES
1070+#else
10701071 error("%s", buf);
10711072 #endif
10721073 }
--- a/pppd/utils.c
+++ b/pppd/utils.c
@@ -649,6 +649,21 @@ print_string(p, len, printer, arg)
649649 printer(arg, "\"");
650650 }
651651
652+/*
653+ * logit - does the hard work for fatal et al.
654+ */
655+static void
656+logit(level, fmt, args)
657+ int level;
658+ char *fmt;
659+ va_list args;
660+{
661+ int n;
662+ char buf[1024];
663+
664+ n = vslprintf(buf, sizeof(buf), fmt, args);
665+ log_write(level, buf);
666+}
652667
653668 #ifdef ANDROID_CHANGES
654669
@@ -669,32 +684,12 @@ static int syslog_to_android[] = {
669684
670685 #endif
671686
672-/*
673- * logit - does the hard work for fatal et al.
674- */
675-static void
676-logit(level, fmt, args)
677- int level;
678- char *fmt;
679- va_list args;
680-{
681- int n;
682- char buf[1024];
683-
684- n = vslprintf(buf, sizeof(buf), fmt, args);
685-
686-#ifndef ANDROID_CHANGES
687- log_write(level, buf);
688-#else
689- __android_log_write(syslog_to_android[level], LOG_TAG, buf);
690-#endif
691-}
692-
693687 static void
694688 log_write(level, buf)
695689 int level;
696690 char *buf;
697691 {
692+#ifndef ANDROID_CHANGES
698693 syslog(level, "%s", buf);
699694
700695 fprintf(stderr, buf);
@@ -708,6 +703,9 @@ log_write(level, buf)
708703 || write(log_to_fd, "\n", 1) != 1)
709704 log_to_fd = -1;
710705 }
706+#else
707+ __android_log_write(syslog_to_android[level], LOG_TAG, buf);
708+#endif
711709 }
712710
713711 /*