source: rtems/c/src/exec/libfs/src/imfs/imfs_chown.c @ b2709481

4.104.114.84.95
Last change on this file since b2709481 was b2709481, checked in by Joel Sherrill <joel.sherrill@…>, on 01/04/02 at 18:30:58

2002-01-04 Ralf Corsepius <corsepiu@…>

  • src/imfs/imfs_eval.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/memfile.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_readlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_unlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_link.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_chown.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/ioman.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_mount.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_directory.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_stat.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_fchmod.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_symlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_mknod.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/linearfile.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs_unmount.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
  • src/imfs/imfs.h: Apply rtems_set_errno_and_return_minus_one. Comment out increment_and_check_linkcounts.
  • 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.OARcorp.com/rtems/license.html.
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.