Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:15

0001 /*
0002  *  lchown() - POSIX 1003.1b 5.6.5 - Change Owner and Group of a File
0003  *             But Do Not Follow a Symlink
0004  *
0005  *  Written by: Vinu Rajashekhar <vinutheraj@gmail.com>
0006  *
0007  *  The license and distribution terms for this file may be
0008  *  found in the file LICENSE in this distribution or at
0009  *  http://www.rtems.org/license/LICENSE.
0010  */
0011 
0012 #ifdef HAVE_CONFIG_H
0013 #include "config.h"
0014 #endif
0015 
0016 #include <unistd.h>
0017 
0018 #include <rtems/libio_.h>
0019 
0020 int lchown( const char *path, uid_t owner, gid_t group )
0021 {
0022   int rv;
0023   rtems_filesystem_eval_path_context_t ctx;
0024   int eval_flags = RTEMS_FS_FOLLOW_HARD_LINK;
0025   const rtems_filesystem_location_info_t *currentloc =
0026     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
0027 
0028   rv = rtems_filesystem_chown( currentloc, owner, group );
0029 
0030   rtems_filesystem_eval_path_cleanup( &ctx );
0031 
0032   return rv;
0033 }