From fab27e479ab68d1a88ea52296b2ebd1e5e9645f8 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 7 Jun 2010 18:37:16 +0000 Subject: 2010-06-07 Joel Sherrill * libcsupport/src/tcflow.c, libcsupport/src/tcflush.c: Add switches to detect bad input. * libcsupport/src/tcsetpgrp.c: Fix typo. --- cpukit/ChangeLog | 6 ++++++ cpukit/libcsupport/src/tcflow.c | 21 ++++++++++++++++++--- cpukit/libcsupport/src/tcflush.c | 18 ++++++++++++++++-- cpukit/libcsupport/src/tcsetpgrp.c | 4 ++-- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index b3b281ad10..24cf8bc98f 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2010-06-07 Joel Sherrill + + * libcsupport/src/tcflow.c, libcsupport/src/tcflush.c: Add switches + to detect bad input. + * libcsupport/src/tcsetpgrp.c: Fix typo. + 2010-06-07 Sebastian Huber * libcsupport/include/rtems/libio_.h: Declare diff --git a/cpukit/libcsupport/src/tcflow.c b/cpukit/libcsupport/src/tcflow.c index b329224b45..d4d3945f38 100644 --- a/cpukit/libcsupport/src/tcflow.c +++ b/cpukit/libcsupport/src/tcflow.c @@ -1,7 +1,7 @@ /* * tcflow() - POSIX 1003.1b 7.2.2 - Line Control Functions * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -18,12 +18,27 @@ #if defined(RTEMS_NEWLIB) #include #include +#include +#include int tcflow ( int fd __attribute__((unused)), - int action __attribute__((unused))) + int action +) { - return 0; + switch (action) { + case TCOOFF: + case TCOON: + case TCIOFF: + case TCION: + default: + rtems_set_errno_and_return_minus_one( EINVAL ); + } + + /* fd is not validated */ + + /* When this is supported, implement it here */ + rtems_set_errno_and_return_minus_one( ENOTSUP ); } #endif diff --git a/cpukit/libcsupport/src/tcflush.c b/cpukit/libcsupport/src/tcflush.c index b05a88e8c0..6546966384 100644 --- a/cpukit/libcsupport/src/tcflush.c +++ b/cpukit/libcsupport/src/tcflush.c @@ -1,7 +1,7 @@ /* * tcflush() - POSIX 1003.1b 7.2.2 - Line Control Functions * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -24,12 +24,26 @@ #include /* #include */ +#include #include int tcflush ( int fd __attribute__((unused)), - int queue __attribute__((unused)) ) + int queue +) { + switch (queue) { + case TCIFLUSH: + case TCOFLUSH: + case TCIOFLUSH: + default: + rtems_set_errno_and_return_minus_one( EINVAL ); + } + + /* fd is not validated */ + + /* When this is supported, implement it here */ + rtems_set_errno_and_return_minus_one( ENOTSUP ); return 0; } diff --git a/cpukit/libcsupport/src/tcsetpgrp.c b/cpukit/libcsupport/src/tcsetpgrp.c index 795d90131b..f8e48025b6 100644 --- a/cpukit/libcsupport/src/tcsetpgrp.c +++ b/cpukit/libcsupport/src/tcsetpgrp.c @@ -1,7 +1,7 @@ /* * tcsetprgrp() - POSIX 1003.1b 7.2.4 - Set Foreground Process Group ID * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -26,7 +26,7 @@ #include -int tcsetprgrp( +int tcsetpgrp( int fd __attribute__((unused)), pid_t pid __attribute__((unused)) ) { -- cgit v1.2.3