source: rtems/cpukit/libcsupport/src/chown.c @ c40d3c4b

4.115
Last change on this file since c40d3c4b was 98b785e, checked in by Joel Sherrill <joel.sherrill@…>, on 07/01/10 at 17:22:03

2010-07-01 Vinu Rajashekhar <vinutheraj@…>

PR 1597/cpukit

  • libcsupport/Makefile.am, libcsupport/src/chown.c: Add lchown() and utimes().
  • libcsupport/src/lchown.c, libcsupport/src/utimes.c: New files.
  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[07a3253d]1/*
2 *  chown() - POSIX 1003.1b 5.6.5 - Change Owner and Group of a File
3 *
[08311cc3]4 *  COPYRIGHT (c) 1989-1999.
[07a3253d]5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
[0eae36c7]9 *  http://www.rtems.com/license/LICENSE.
[07a3253d]10 *
11 *  $Id$
12 */
13
[9c49db4]14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
[07a3253d]18#include <sys/stat.h>
19#include <errno.h>
20
21#include <rtems.h>
22#include <rtems/libio.h>
23
[3ba74c73]24#include <rtems/libio_.h>
[a02224e]25#include <rtems/seterr.h>
[07a3253d]26
[98b785e]27int _chown_helper(
[07a3253d]28  const char *path,
29  uid_t       owner,
[98b785e]30  gid_t       group,
31  int         follow_link
[07a3253d]32)
33{
[d71fcab]34  rtems_filesystem_location_info_t   loc;
35  int                                result;
[07a3253d]36
[98b785e]37  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &loc, follow_link ) )
[07a3253d]38    return -1;
[50f32b11]39
[9c3fa30]40  result = (*loc.ops->chown_h)( &loc, owner, group );
[d71fcab]41
[dd0f326]42  rtems_filesystem_freenode( &loc );
[50f32b11]43
[d71fcab]44  return result;
[07a3253d]45}
[98b785e]46
47int chown(
48  const char *path,
49  uid_t       owner,
50  gid_t       group
51)
52{
53  return _chown_helper( path, owner, group, true );
54}
Note: See TracBrowser for help on using the repository browser.