#
# 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"