]> git.ozlabs.org Git - ppp.git/commitdiff
Don't prepend /dev/ to a possible device name if it already begins
authorPaul Mackerras <paulus@samba.org>
Sun, 24 Oct 2004 23:53:05 +0000 (23:53 +0000)
committerPaul Mackerras <paulus@samba.org>
Sun, 24 Oct 2004 23:53:05 +0000 (23:53 +0000)
with '/' (i.e. just check for / instead of /dev/ as before).
This allows /udev/blah to be used as a tty device name.
Requested by Pawel Sakowski.

pppd/tty.c

index dbfc67e3864482c8d2e72790acceef72e23cd31f..d39d4a4dea57367f53799901966ff8be44bcee21 100644 (file)
@@ -73,7 +73,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: tty.c,v 1.14 2004/01/17 05:47:55 carlsonj Exp $"
+#define RCSID  "$Id: tty.c,v 1.15 2004/10/24 23:53:05 paulus Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -300,7 +300,7 @@ setdevname(cp, argv, doit)
        if (*cp == 0)
                return 0;
 
        if (*cp == 0)
                return 0;
 
-       if (strncmp("/dev/", cp, 5) != 0) {
+       if (*cp != '/') {
                strlcpy(dev, "/dev/", sizeof(dev));
                strlcat(dev, cp, sizeof(dev));
                cp = dev;
                strlcpy(dev, "/dev/", sizeof(dev));
                strlcat(dev, cp, sizeof(dev));
                cp = dev;