source: rtems/cpukit/libfs/src/imfs/imfs_chown.c @ 7c007cf

4.104.114.95
Last change on this file since 7c007cf was a5305f6b, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/17/04 at 08:34:41

Remove stray white spaces.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  IMFS_chown
3 *
4 *  This routine is the implementation of the chown() system
5 *  call for the IMFS.
6 *
7 *  COPYRIGHT (c) 1989-1999.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <errno.h>
22#include <rtems/libio_.h>
23#include <rtems/seterr.h>
24#include "imfs.h"
25
26int IMFS_chown(
27  rtems_filesystem_location_info_t  *pathloc,       /* IN */
28  uid_t                              owner,         /* IN */
29  gid_t                              group          /* IN */
30)
31{
32  IMFS_jnode_t  *jnode;
33#if defined(RTEMS_POSIX_API)
34  uid_t          st_uid;
35#endif
36
37  jnode = (IMFS_jnode_t *) pathloc->node_access;
38
39  /*
40   *  Verify I am the owner of the node or the super user.
41   */
42
43#if defined(RTEMS_POSIX_API)
44  st_uid = geteuid();
45
46  if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
47    rtems_set_errno_and_return_minus_one( EPERM );
48#endif
49
50  jnode->st_uid = owner;
51  jnode->st_gid = group;
52
53  IMFS_update_ctime( jnode );
54
55  return 0;
56}
Note: See TracBrowser for help on using the repository browser.