summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-15 17:43:02 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-15 17:43:02 +0000
commit5860b90232302865678a6efe57f92ae60a5ef562 (patch)
tree98dd49bc888daa29a230b74c0d2938f87197242b /cpukit
parent2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-5860b90232302865678a6efe57f92ae60a5ef562.tar.bz2
2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
* posix/src/getitimer.c, posix/src/setitimer.c: Add error checks and clean up so coverage analysis is possible.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog5
-rw-r--r--cpukit/posix/src/getitimer.c17
-rw-r--r--cpukit/posix/src/setitimer.c18
3 files changed, 29 insertions, 11 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 295055c797..029494998a 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,10 @@
2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
+ * posix/src/getitimer.c, posix/src/setitimer.c: Add error checks and
+ clean up so coverage analysis is possible.
+
+2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
+
* posix/src/sysconf.c: Restructure to improve coverage analysis.
2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
diff --git a/cpukit/posix/src/getitimer.c b/cpukit/posix/src/getitimer.c
index 1892a6016f..8d1bb97904 100644
--- a/cpukit/posix/src/getitimer.c
+++ b/cpukit/posix/src/getitimer.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2008.
+ * COPYRIGHT (c) 1989-20089
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -23,12 +23,17 @@ int getitimer(
struct itimerval *value
)
{
+ if ( !value )
+ rtems_set_errno_and_return_minus_one( EFAULT );
+
switch ( which ) {
- case ITIMER_REAL: break;
- case ITIMER_VIRTUAL: break;
- case ITIMER_PROF: break;
+ case ITIMER_REAL:
+ case ITIMER_VIRTUAL:
+ case ITIMER_PROF:
+ rtems_set_errno_and_return_minus_one( ENOSYS );
+ default:
+ break;
}
- rtems_set_errno_and_return_minus_one( ENOSYS );
- /* return -1; */
+ rtems_set_errno_and_return_minus_one( EINVAL );
}
diff --git a/cpukit/posix/src/setitimer.c b/cpukit/posix/src/setitimer.c
index 1895838155..24a4723100 100644
--- a/cpukit/posix/src/setitimer.c
+++ b/cpukit/posix/src/setitimer.c
@@ -24,12 +24,20 @@ int setitimer(
struct itimerval *ovalue
)
{
+ if ( !value )
+ rtems_set_errno_and_return_minus_one( EFAULT );
+
+ if ( !ovalue )
+ rtems_set_errno_and_return_minus_one( EFAULT );
+
switch ( which ) {
- case ITIMER_REAL: break;
- case ITIMER_VIRTUAL: break;
- case ITIMER_PROF: break;
+ case ITIMER_REAL:
+ case ITIMER_VIRTUAL:
+ case ITIMER_PROF:
+ rtems_set_errno_and_return_minus_one( ENOSYS );
+ default:
+ break;
}
- rtems_set_errno_and_return_minus_one( ENOSYS );
- /* return -1; */
+ rtems_set_errno_and_return_minus_one( EINVAL );
}