summaryrefslogtreecommitdiff
path: root/packages/ppp/ppp-2.4.3/pppd-resolv-varrun.patch
blob: c22d8cc085896abafb6480f6e608cea05d0743e9 (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

#
# Patch managed by http://www.holgerschurig.de/patcher.html
#

--- ppp-2.4.3/pppd/ipcp.c~pppd-resolv-varrun.patch
+++ ppp-2.4.3/pppd/ipcp.c
@@ -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"
@@ -2032,6 +2034,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-2.4.3/pppd/pathnames.h~pppd-resolv-varrun.patch
+++ ppp-2.4.3/pppd/pathnames.h
@@ -29,7 +29,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"