OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libfs/] [src/] [imfs/] [imfs_chown.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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.OARcorp.com/rtems/license.html.
13
 *
14
 *  imfs_chown.c,v 1.6 2002/01/04 18:30:58 joel Exp
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
 
26
int 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.