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

4.11
Last change on this file since df4669f was df4669f, checked in by Ralf Corsepius <ralf.corsepius@…>, on Dec 5, 2011 at 2:20:38 PM

2011-12-05 Ralf Corsépius <ralf.corsepius@…>

  • libcsupport/src/chown.c, libcsupport/src/lchown.c: Include <unistd.h>. Cleanup included headers.
  • Property mode set to 100644
File size: 996 bytes
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 <unistd.h>
19
20#include <rtems.h>
21#include <rtems/libio_.h>
22
23int _chown_helper(
24  const char *path,
25  uid_t       owner,
26  gid_t       group,
27  int         follow_link
28)
29{
30  rtems_filesystem_location_info_t   loc;
31  int                                result;
32
33  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &loc, follow_link ) )
34    return -1;
35
36  result = (*loc.ops->chown_h)( &loc, owner, group );
37
38  rtems_filesystem_freenode( &loc );
39
40  return result;
41}
42
43int chown(
44  const char *path,
45  uid_t       owner,
46  gid_t       group
47)
48{
49  return _chown_helper( path, owner, group, true );
50}
Note: See TracBrowser for help on using the repository browser.