source: rtems/cpukit/libcsupport/src/chown.c @ 98b785e

4.115
Last change on this file since 98b785e 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
Line 
1/*
2 *  chown() - POSIX 1003.1b 5.6.5 - Change Owner and Group of a File
3 *
4 *  COPYRIGHT (c) 1989-1999.
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
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <sys/stat.h>
19#include <errno.h>
20
21#include <rtems.h>
22#include <rtems/libio.h>
23
24#include <rtems/libio_.h>
25#include <rtems/seterr.h>
26
27int _chown_helper(
28  const char *path,
29  uid_t       owner,
30  gid_t       group,
31  int         follow_link
32)
33{
34  rtems_filesystem_location_info_t   loc;
35  int                                result;
36
37  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &loc, follow_link ) )
38    return -1;
39
40  result = (*loc.ops->chown_h)( &loc, owner, group );
41
42  rtems_filesystem_freenode( &loc );
43
44  return result;
45}
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.