diff options
author | François Andriot <francois.andriot@free.fr> | 2014-07-05 18:51:40 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2014-07-05 18:51:40 +0200 |
commit | e0801ae20055f65db90f62f2e14324cbabda29bf (patch) | |
tree | e1a93685a13e523a532fd32b8f48594b3ade27ff /kppp | |
parent | 6f74f0b0620d6a8b016ff0c07bfe01c47e007767 (diff) | |
download | tdenetwork-e0801ae20055f65db90f62f2e14324cbabda29bf.tar.gz tdenetwork-e0801ae20055f65db90f62f2e14324cbabda29bf.zip |
Use alternate 'resolv.conf' in kppp, if available
Diffstat (limited to 'kppp')
-rw-r--r-- | kppp/connect.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kppp/connect.cpp b/kppp/connect.cpp index 879de553..eba8da1e 100644 --- a/kppp/connect.cpp +++ b/kppp/connect.cpp @@ -1469,9 +1469,13 @@ void adddns() void addpeerdns() { int fd, fd2; + TQString p = "/var/run/ppp/resolv.conf"; + + if (!TQFile::exists(p)) + p = "/etc/ppp/resolv.conf"; if((fd = Requester::rq->openResolv(O_WRONLY|O_APPEND)) >= 0) { - if((fd2 = open("/etc/ppp/resolv.conf", O_RDONLY)) >= 0) { + if((fd2 = open(p.latin1(), O_RDONLY)) >= 0) { char c; int i = 0; while(i++ < 100 && read(fd2, &c, 1) == 1) { @@ -1482,7 +1486,7 @@ void addpeerdns() { } close(fd2); } else - fprintf(stderr, "failed to read from /etc/ppp/resolv.conf\n"); + fprintf(stderr, "failed to read from %s\n", p.latin1()); close(fd); } add_domain(gpppdata.domain()); |