Use alternate 'resolv.conf' in kppp, if available

pull/1/head
François Andriot 10 years ago committed by Slávek Banko
parent 6f74f0b062
commit e0801ae200

@ -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());

Loading…
Cancel
Save