]> git.ozlabs.org Git - ppp.git/commitdiff
make /dev/ppp if necessary
authorPaul Mackerras <paulus@samba.org>
Fri, 13 Aug 1999 01:57:55 +0000 (01:57 +0000)
committerPaul Mackerras <paulus@samba.org>
Fri, 13 Aug 1999 01:57:55 +0000 (01:57 +0000)
pppd/sys-linux.c

index a8e91b9423342fed25c594199f15492f750a9546..c25758ed4a193294d918db76b0c07a8bfb1b1541 100644 (file)
@@ -1634,6 +1634,19 @@ int ppp_available(void)
        "See README.linux file in the ppp distribution for more details.\n";
 
     fd = open("/dev/ppp", O_RDWR);
+    if (fd < 0 && errno == ENOENT) {
+       /* try making it and see if that helps. */
+       if (mknod("/dev/ppp", S_IFCHR | S_IRUSR | S_IWUSR,
+                 makedev(108, 0)) >= 0) {
+           fd = open("/dev/ppp", O_RDWR);
+           if (fd >= 0)
+               info("Created /dev/ppp device node");
+           else
+               unlink("/dev/ppp");     /* didn't work, undo the mknod */
+       } else if (errno == EEXIST) {
+           fd = open("/dev/ppp", O_RDWR);
+       }
+    }
     if (fd >= 0) {
        new_style_driver = 1;