diff options
-rw-r--r-- | c/src/exec/libcsupport/src/termios.c | 9 | ||||
-rw-r--r-- | c/src/lib/libc/cfiospeed.c | 2 | ||||
-rw-r--r-- | c/src/lib/libc/termios.c | 9 | ||||
-rw-r--r-- | cpukit/libcsupport/src/termios.c | 9 |
4 files changed, 7 insertions, 22 deletions
diff --git a/c/src/exec/libcsupport/src/termios.c b/c/src/exec/libcsupport/src/termios.c index f6b5652e57..f3637d37e3 100644 --- a/c/src/exec/libcsupport/src/termios.c +++ b/c/src/exec/libcsupport/src/termios.c @@ -286,19 +286,14 @@ rtems_termios_open ( tty->termios.c_cc[VLNEXT] = '\026'; /* - * Device-specific open - */ - if (tty->device.firstOpen) - (*tty->device.firstOpen)(major, minor, arg); - - /* * Bump name characer */ if (c++ == 'z') c = 'a'; } - tty->refcount++; args->iop->data1 = tty; + if (!tty->refcount++ && tty->device.firstOpen) + (*tty->device.firstOpen)(major, minor, arg); rtems_semaphore_release (ttyMutex); return RTEMS_SUCCESSFUL; } diff --git a/c/src/lib/libc/cfiospeed.c b/c/src/lib/libc/cfiospeed.c index 772d6083c9..c2f40d3892 100644 --- a/c/src/lib/libc/cfiospeed.c +++ b/c/src/lib/libc/cfiospeed.c @@ -47,7 +47,7 @@ cfsetispeed(struct termios *tp, speed_t speed) errno = EINVAL; return -1; } - tp->c_cflag = (tp->c_cflag & ~CBAUD) | (speed * (CIBAUD / CBAUD)); + tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD)); return 0; } diff --git a/c/src/lib/libc/termios.c b/c/src/lib/libc/termios.c index f6b5652e57..f3637d37e3 100644 --- a/c/src/lib/libc/termios.c +++ b/c/src/lib/libc/termios.c @@ -286,19 +286,14 @@ rtems_termios_open ( tty->termios.c_cc[VLNEXT] = '\026'; /* - * Device-specific open - */ - if (tty->device.firstOpen) - (*tty->device.firstOpen)(major, minor, arg); - - /* * Bump name characer */ if (c++ == 'z') c = 'a'; } - tty->refcount++; args->iop->data1 = tty; + if (!tty->refcount++ && tty->device.firstOpen) + (*tty->device.firstOpen)(major, minor, arg); rtems_semaphore_release (ttyMutex); return RTEMS_SUCCESSFUL; } diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index f6b5652e57..f3637d37e3 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -286,19 +286,14 @@ rtems_termios_open ( tty->termios.c_cc[VLNEXT] = '\026'; /* - * Device-specific open - */ - if (tty->device.firstOpen) - (*tty->device.firstOpen)(major, minor, arg); - - /* * Bump name characer */ if (c++ == 'z') c = 'a'; } - tty->refcount++; args->iop->data1 = tty; + if (!tty->refcount++ && tty->device.firstOpen) + (*tty->device.firstOpen)(major, minor, arg); rtems_semaphore_release (ttyMutex); return RTEMS_SUCCESSFUL; } |