4.104.114.84.95
Last change
on this file since 72650fcb was
bc2db66,
checked in by Joel Sherrill <joel.sherrill@…>, on 11/07/01 at 23:54:59
|
2001-11-07 Jennifer Averett <jennifer@…>
Reported by Ibragimov Ilya <ibr@…> and tracked as PR63.
- libc/chdir.c: Check for search/execute permissions on chdir.
This requires passing RTEMS_LIBIO_PERMS_SEARCH to
rtems_filesystem_evaluate_path().
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * chdir() - POSIX 1003.1b - 5.2.1 - Change Current Working Directory |
---|
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.OARcorp.com/rtems/license.html. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #if HAVE_CONFIG_H |
---|
15 | #include "config.h" |
---|
16 | #endif |
---|
17 | |
---|
18 | #include <rtems.h> |
---|
19 | |
---|
20 | #include <unistd.h> |
---|
21 | #include <errno.h> |
---|
22 | |
---|
23 | #include <rtems/libio_.h> |
---|
24 | |
---|
25 | int chdir( |
---|
26 | const char *pathname |
---|
27 | ) |
---|
28 | { |
---|
29 | rtems_filesystem_location_info_t loc; |
---|
30 | int result; |
---|
31 | |
---|
32 | /* |
---|
33 | * Get the node where we wish to go. |
---|
34 | */ |
---|
35 | |
---|
36 | result = rtems_filesystem_evaluate_path( |
---|
37 | pathname, RTEMS_LIBIO_PERMS_SEARCH, &loc, TRUE ); |
---|
38 | if ( result != 0 ) |
---|
39 | return -1; |
---|
40 | |
---|
41 | /* |
---|
42 | * Verify you can change directory into this node. |
---|
43 | */ |
---|
44 | |
---|
45 | if ( !loc.ops->node_type_h ) { |
---|
46 | rtems_filesystem_freenode( &loc ); |
---|
47 | set_errno_and_return_minus_one( ENOTSUP ); |
---|
48 | } |
---|
49 | |
---|
50 | if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) { |
---|
51 | rtems_filesystem_freenode( &loc ); |
---|
52 | set_errno_and_return_minus_one( ENOTDIR ); |
---|
53 | } |
---|
54 | |
---|
55 | rtems_filesystem_freenode( &rtems_filesystem_current ); |
---|
56 | |
---|
57 | rtems_filesystem_current = loc; |
---|
58 | |
---|
59 | return 0; |
---|
60 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.