summaryrefslogtreecommitdiffstats
path: root/kppp
diff options
context:
space:
mode:
authorFrançois Andriot <francois.andriot@free.fr>2014-07-05 18:51:40 +0200
committerSlávek Banko <slavek.banko@axis.cz>2014-07-05 18:51:40 +0200
commite0801ae20055f65db90f62f2e14324cbabda29bf (patch)
treee1a93685a13e523a532fd32b8f48594b3ade27ff /kppp
parent6f74f0b0620d6a8b016ff0c07bfe01c47e007767 (diff)
downloadtdenetwork-e0801ae20055f65db90f62f2e14324cbabda29bf.tar.gz
tdenetwork-e0801ae20055f65db90f62f2e14324cbabda29bf.zip
Use alternate 'resolv.conf' in kppp, if available
Diffstat (limited to 'kppp')
-rw-r--r--kppp/connect.cpp8
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());