diff options
Diffstat (limited to 'cpukit/libcsupport/src/chown.c')
-rw-r--r-- | cpukit/libcsupport/src/chown.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/cpukit/libcsupport/src/chown.c b/cpukit/libcsupport/src/chown.c index 9ecaea11f7..1d07384d7d 100644 --- a/cpukit/libcsupport/src/chown.c +++ b/cpukit/libcsupport/src/chown.c @@ -4,6 +4,9 @@ * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * + * Modifications to support reference counting in the file system are + * Copyright (c) 2012 embedded brains GmbH. + * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. @@ -12,39 +15,38 @@ */ #if HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif #include <unistd.h> -#include <rtems.h> #include <rtems/libio_.h> -int _chown_helper( +int rtems_filesystem_chown( const char *path, - uid_t owner, - gid_t group, - int follow_link + uid_t owner, + gid_t group, + int eval_follow_link ) { - rtems_filesystem_location_info_t loc; - int result; - - if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &loc, follow_link ) ) - return -1; + int rv = 0; + rtems_filesystem_eval_path_context_t ctx; + int eval_flags = eval_follow_link; + const rtems_filesystem_location_info_t *currentloc = + rtems_filesystem_eval_path_start( &ctx, path, eval_flags ); - result = (*loc.ops->chown_h)( &loc, owner, group ); + rv = (*currentloc->ops->chown_h)( + currentloc, + owner, + group + ); - rtems_filesystem_freenode( &loc ); + rtems_filesystem_eval_path_cleanup( &ctx ); - return result; + return rv; } -int chown( - const char *path, - uid_t owner, - gid_t group -) +int chown( const char *path, uid_t owner, gid_t group ) { - return _chown_helper( path, owner, group, true ); + return rtems_filesystem_chown( path, owner, group, RTEMS_LIBIO_FOLLOW_LINK ); } |