summaryrefslogtreecommitdiff
path: root/packages/ppp/ppp-2.4.1/pppd-resolv-varrun.patch
blob: ba5af253b42f580780ad202a092334401817bd0c (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
--- ppp/pppd/ipcp.c	2001-03-08 18:11:12.000000000 +1300
+++ ppp/pppd/ipcp.c	2005-02-06 14:10:13.055551720 +1300
@@ -32,6 +32,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"
@@ -1859,6 +1861,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) {
--- ppp/pppd/pathnames.h	2001-03-08 18:15:37.000000000 +1300
+++ ppp/pppd/pathnames.h	2005-02-06 14:01:19.423676096 +1300
@@ -28,7 +28,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"