summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/chdir.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-04-28 15:01:31 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-04-28 15:01:31 +0000
commitcbe57ec919310139084f57641f136c01ea15307d (patch)
tree7c315bb3230685a012f7b411eb266e3a103ca2a0 /cpukit/libcsupport/src/chdir.c
parent2010-04-28 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff)
downloadrtems-cbe57ec919310139084f57641f136c01ea15307d.tar.bz2
2010-04-28 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/src/chdir.c: Check for NULL pointer.
Diffstat (limited to 'cpukit/libcsupport/src/chdir.c')
-rw-r--r--cpukit/libcsupport/src/chdir.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cpukit/libcsupport/src/chdir.c b/cpukit/libcsupport/src/chdir.c
index ccc7a567ba..fe8796cb35 100644
--- a/cpukit/libcsupport/src/chdir.c
+++ b/cpukit/libcsupport/src/chdir.c
@@ -1,7 +1,7 @@
/*
* chdir() - POSIX 1003.1b - 5.2.1 - Change Current Working Directory
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2010.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -30,10 +30,12 @@ int chdir(
rtems_filesystem_location_info_t loc;
int result;
+ if ( !pathname )
+ rtems_set_errno_and_return_minus_one( EFAULT );
+
/*
* Get the node where we wish to go.
*/
-
result = rtems_filesystem_evaluate_path(
pathname, strlen( pathname ), RTEMS_LIBIO_PERMS_SEARCH, &loc, true );
if ( result != 0 )
@@ -42,7 +44,6 @@ int chdir(
/*
* Verify you can change directory into this node.
*/
-
if ( !loc.ops->node_type_h ) {
rtems_filesystem_freenode( &loc );
rtems_set_errno_and_return_minus_one( ENOTSUP );