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