slcand: accept both tty* and /dev/tty* device names

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
pull/1/head
Yegor Yefremov 2014-01-23 09:49:23 +01:00 committed by Marc Kleine-Budde
parent 9c82d462f4
commit 49801ea8a6
1 changed files with 4 additions and 3 deletions

View File

@ -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 */