4.104.114.84.95
Last change
on this file since c7016198 was
dd0f326,
checked in by Joel Sherrill <joel.sherrill@…>, on 10/12/99 at 19:10:46
|
Added rtems_filesystem_freenode() macro and added calls at appropriate
places to make sure memory allocated for filesystem specifif nodes
gets freed.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * readlink() - POSIX 1003.1b - X.X.X - XXX |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1998. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * Copyright assigned to U.S. Government, 1994. |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.OARcorp.com/rtems/license.html. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #include "libio_.h" |
---|
16 | |
---|
17 | int readlink( |
---|
18 | const char *pathname, |
---|
19 | char *buf, |
---|
20 | int bufsize |
---|
21 | ) |
---|
22 | { |
---|
23 | rtems_filesystem_location_info_t loc; |
---|
24 | int result; |
---|
25 | |
---|
26 | if (!buf) |
---|
27 | set_errno_and_return_minus_one( EFAULT ); |
---|
28 | |
---|
29 | result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE ); |
---|
30 | if ( result != 0 ) |
---|
31 | return -1; |
---|
32 | |
---|
33 | if ( !loc.ops->node_type ){ |
---|
34 | rtems_filesystem_freenode( &loc ); |
---|
35 | set_errno_and_return_minus_one( ENOTSUP ); |
---|
36 | } |
---|
37 | |
---|
38 | if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){ |
---|
39 | rtems_filesystem_freenode( &loc ); |
---|
40 | set_errno_and_return_minus_one( EINVAL ); |
---|
41 | } |
---|
42 | |
---|
43 | if ( !loc.ops->readlink ){ |
---|
44 | rtems_filesystem_freenode( &loc ); |
---|
45 | set_errno_and_return_minus_one( ENOTSUP ); |
---|
46 | } |
---|
47 | |
---|
48 | result = (*loc.ops->readlink)( &loc, buf, bufsize ); |
---|
49 | |
---|
50 | rtems_filesystem_freenode( &loc ); |
---|
51 | |
---|
52 | return result; |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.