summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/ppp/ppp-2.4.5/pppd-resolv-varrun.patch
blob: c4e61fdd289c51b9e769ffe3f62bdf407de72f36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
The patch comes from OpenEmbedded
Rebased for ppp-2.4.5. Dongxiao Xu <dongxiao.xu@intel.com>

diff -ruN ppp-2.4.5-orig/pppd/ipcp.c ppp-2.4.5/pppd/ipcp.c
--- ppp-2.4.5-orig/pppd/ipcp.c	2010-06-30 15:51:12.050166398 +0800
+++ ppp-2.4.5/pppd/ipcp.c	2010-06-30 17:02:33.930393283 +0800
@@ -55,6 +55,8 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include "pppd.h"
 #include "fsm.h"
@@ -2095,6 +2097,14 @@
     u_int32_t peerdns1, peerdns2;
 {
     FILE *f;
+    struct stat dirinfo;
+
+    if(stat(_PATH_OUTDIR, &dirinfo)) {
+        if(mkdir(_PATH_OUTDIR, 0775)) {
+            error("Failed to create directory %s: %m", _PATH_OUTDIR);
+            return;
+        }
+    }
 
     f = fopen(_PATH_RESOLV, "w");
     if (f == NULL) {
diff -ruN ppp-2.4.5-orig/pppd/pathnames.h ppp-2.4.5/pppd/pathnames.h
--- ppp-2.4.5-orig/pppd/pathnames.h	2010-06-30 15:51:12.043682063 +0800
+++ ppp-2.4.5/pppd/pathnames.h	2010-06-30 17:03:20.594371055 +0800
@@ -30,7 +30,8 @@
 #define _PATH_TTYOPT	 _ROOT_PATH "/etc/ppp/options."
 #define _PATH_CONNERRS	 _ROOT_PATH "/etc/ppp/connect-errors"
 #define _PATH_PEERFILES	 _ROOT_PATH "/etc/ppp/peers/"
-#define _PATH_RESOLV	 _ROOT_PATH "/etc/ppp/resolv.conf"
+#define _PATH_OUTDIR	_ROOT_PATH _PATH_VARRUN "/ppp"
+#define _PATH_RESOLV	_PATH_OUTDIR "/resolv.conf"
 
 #define _PATH_USEROPT	 ".ppprc"
 #define	_PATH_PSEUDONYM	 ".ppp_pseudonym"