Branch: master

e0801ae2 2014-07-05 11:51:40 François Andriot
Use alternate 'resolv.conf' in kppp, if available
M kppp/connect.cpp
diff --git a/kppp/connect.cpp b/kppp/connect.cpp
index 879de55..eba8da1 100644
--- a/kppp/connect.cpp
+++ b/kppp/connect.cpp
@@ -1469,9 +1469,13 @@
 
 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 @@
       }
       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());