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

4.115
Last change on this file since c17d0b3 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.0 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
15#if HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include "imfs.h"
20
21#include <unistd.h>
22
23#include <rtems/libio_.h>
24
25int IMFS_chown(
26  const rtems_filesystem_location_info_t *loc,
27  uid_t owner,
28  gid_t group
29)
30{
31  IMFS_jnode_t  *jnode;
32#if defined(RTEMS_POSIX_API)
33  uid_t          st_uid;
34#endif
35
36  jnode = (IMFS_jnode_t *) loc->node_access;
37
38  /*
39   *  Verify I am the owner of the node or the super user.
40   */
41
42#if defined(RTEMS_POSIX_API)
43  st_uid = geteuid();
44
45  if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
46    rtems_set_errno_and_return_minus_one( EPERM );
47#endif
48
49  jnode->st_uid = owner;
50  jnode->st_gid = group;
51
52  IMFS_update_ctime( jnode );
53
54  return 0;
55}
Note: See TracBrowser for help on using the repository browser.