From 49801ea8a65415a93b50d47e6eae96c25855e781 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Thu, 23 Jan 2014 09:49:23 +0100 Subject: [PATCH] slcand: accept both tty* and /dev/tty* device names Signed-off-by: Yegor Yefremov Signed-off-by: Marc Kleine-Budde --- slcand.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/slcand.c b/slcand.c index 69d30f7..831e8c6 100644 --- a/slcand.c +++ b/slcand.c @@ -251,10 +251,11 @@ int main(int argc, char *argv[]) /* Prepare the tty device name string */ pch = strstr(tty, devprefix); - if (pch == tty) - print_usage(argv[0]); + if (pch != tty) + snprintf(ttypath, TTYPATH_LENGTH, "%s%s", devprefix, tty); + else + snprintf(ttypath, TTYPATH_LENGTH, "%s", tty); - snprintf(ttypath, TTYPATH_LENGTH, "%s%s", devprefix, tty); syslog(LOG_INFO, "starting on TTY device %s", ttypath); /* Daemonize */ -- 2.7.4