summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libcsupport')
-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 );