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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libc/] [imfs_chown.c] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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
 *  $Id: imfs_chown.c,v 1.2 2001-09-27 12:01:15 chris Exp $
15
 */
16
 
17
#include <errno.h>
18
#include "libio_.h"
19
#include "imfs.h"
20
 
21
int IMFS_chown(
22
  rtems_filesystem_location_info_t  *pathloc,       /* IN */
23
  uid_t                              owner,         /* IN */
24
  gid_t                              group          /* IN */
25
)
26
{
27
  IMFS_jnode_t  *jnode;
28
#if defined(RTEMS_POSIX_API)
29
  uid_t          st_uid;
30
#endif
31
 
32
  jnode = (IMFS_jnode_t *) pathloc->node_access;
33
 
34
  /*
35
   *  Verify I am the owner of the node or the super user.
36
   */
37
 
38
#if defined(RTEMS_POSIX_API)
39
  st_uid = geteuid();
40
 
41
  if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
42
    set_errno_and_return_minus_one( EPERM );
43
#endif
44
 
45
  jnode->st_uid = owner;
46
  jnode->st_gid = group;
47
 
48
  IMFS_update_ctime( jnode );
49
 
50
  return 0;
51
}

powered by: WebSVN 2.1.0

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