4.104.114.95
Last change
on this file since f73fc29 was
f73fc29,
checked in by Joel Sherrill <joel.sherrill@…>, on 08/18/08 at 19:18:52
|
2008-08-18 Joel Sherrill <joel.sherrill@…>
- itron/include/rtems/itron/task.h, itron/src/def_cyc.c,
itron/src/task.c, libcsupport/src/newlibc_exit.c,
libcsupport/src/sync.c, libfs/src/imfs/imfs_fchmod.c,
posix/include/rtems/posix/pthread.h, posix/src/pthread.c,
posix/src/sysconf.c, rtems/include/rtems/rtems/tasks.h,
rtems/src/tasks.c, score/include/rtems/score/stack.h,
score/inline/rtems/score/stack.inl,
score/inline/rtems/score/thread.inl, score/src/threadhandler.c: Fix
various nested-externs warnings.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * IMFS file change mode routine. |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1999. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #if HAVE_CONFIG_H |
---|
15 | #include "config.h" |
---|
16 | #endif |
---|
17 | |
---|
18 | #include <errno.h> |
---|
19 | |
---|
20 | #include <rtems/libio_.h> |
---|
21 | #include <rtems/seterr.h> |
---|
22 | #include "imfs.h" |
---|
23 | |
---|
24 | int IMFS_fchmod( |
---|
25 | rtems_filesystem_location_info_t *loc, |
---|
26 | mode_t mode |
---|
27 | ) |
---|
28 | { |
---|
29 | IMFS_jnode_t *jnode; |
---|
30 | #if defined(RTEMS_POSIX_API) |
---|
31 | uid_t st_uid; |
---|
32 | #endif |
---|
33 | |
---|
34 | jnode = loc->node_access; |
---|
35 | |
---|
36 | /* |
---|
37 | * Verify I am the owner of the node or the super user. |
---|
38 | */ |
---|
39 | #if defined(RTEMS_POSIX_API) |
---|
40 | st_uid = geteuid(); |
---|
41 | |
---|
42 | if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) ) |
---|
43 | rtems_set_errno_and_return_minus_one( EPERM ); |
---|
44 | #endif |
---|
45 | |
---|
46 | /* |
---|
47 | * Change only the RWX permissions on the jnode to mode. |
---|
48 | */ |
---|
49 | if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) ) |
---|
50 | rtems_set_errno_and_return_minus_one( EPERM ); |
---|
51 | |
---|
52 | jnode->st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO); |
---|
53 | jnode->st_mode |= mode; |
---|
54 | |
---|
55 | IMFS_update_ctime( jnode ); |
---|
56 | |
---|
57 | return 0; |
---|
58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.