aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/ppp/ppp-2.4.1/pppd-resolv-varrun.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/ppp/ppp-2.4.1/pppd-resolv-varrun.patch')
-rw-r--r--recipes/ppp/ppp-2.4.1/pppd-resolv-varrun.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/recipes/ppp/ppp-2.4.1/pppd-resolv-varrun.patch b/recipes/ppp/ppp-2.4.1/pppd-resolv-varrun.patch
new file mode 100644
index 0000000000..ba5af253b4
--- /dev/null
+++ b/recipes/ppp/ppp-2.4.1/pppd-resolv-varrun.patch
@@ -0,0 +1,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"
+