From cbe57ec919310139084f57641f136c01ea15307d Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 28 Apr 2010 15:01:31 +0000 Subject: 2010-04-28 Joel Sherrill * libcsupport/src/chdir.c: Check for NULL pointer. --- cpukit/ChangeLog | 4 ++++ cpukit/libcsupport/src/chdir.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 0dab695663..d57519cb9d 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,7 @@ +2010-04-28 Joel Sherrill + + * libcsupport/src/chdir.c: Check for NULL pointer. + 2010-04-25 Joel Sherrill * libfs/src/rfs/rtems-rfs-bitmaps-ut.c: Fix warning. 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 ); -- cgit v1.2.3