4.104.114.84.95
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 | #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 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.