diff options
| author | brad <> | 2005-03-29 19:34:14 +0000 |
|---|---|---|
| committer | brad <> | 2005-03-29 19:34:14 +0000 |
| commit | cc22824e6cee4353df96b7aeec5d080789306136 (patch) | |
| tree | ac79e1c920fdd0d5072069f235127ad7ae5ca0b7 /src/lib/libc/stdlib/realpath.3 | |
| parent | 692d9f352c2adc7dc27feedeecb0aec78410acba (diff) | |
| download | openbsd-cc22824e6cee4353df96b7aeec5d080789306136.tar.gz openbsd-cc22824e6cee4353df96b7aeec5d080789306136.tar.bz2 openbsd-cc22824e6cee4353df96b7aeec5d080789306136.zip | |
Make realpath() thread-safe. New implementation does not use chdir(2) at all.
From: FreeBSD by Constantin S. Svintsoff <kostik (at) iclub.nsu.ru>
ok otto@ millert@
Diffstat (limited to 'src/lib/libc/stdlib/realpath.3')
| -rw-r--r-- | src/lib/libc/stdlib/realpath.3 | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/lib/libc/stdlib/realpath.3 b/src/lib/libc/stdlib/realpath.3 index b8093b51e1..c178f0a9d3 100644 --- a/src/lib/libc/stdlib/realpath.3 +++ b/src/lib/libc/stdlib/realpath.3 | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | .\" SUCH DAMAGE. | 29 | .\" SUCH DAMAGE. |
| 30 | .\" | 30 | .\" |
| 31 | .\" $OpenBSD: realpath.3,v 1.10 2003/06/02 20:18:38 millert Exp $ | 31 | .\" $OpenBSD: realpath.3,v 1.11 2005/03/29 19:34:14 brad Exp $ |
| 32 | .\" | 32 | .\" |
| 33 | .Dd February 16, 1994 | 33 | .Dd February 16, 1994 |
| 34 | .Dt REALPATH 3 | 34 | .Dt REALPATH 3 |
| @@ -40,7 +40,7 @@ | |||
| 40 | .Fd #include <sys/param.h> | 40 | .Fd #include <sys/param.h> |
| 41 | .Fd #include <stdlib.h> | 41 | .Fd #include <stdlib.h> |
| 42 | .Ft "char *" | 42 | .Ft "char *" |
| 43 | .Fn realpath "const char *pathname" "char resolvedname[MAXPATHLEN]" | 43 | .Fn realpath "const char *pathname" "char resolved[PATH_MAX]" |
| 44 | .Sh DESCRIPTION | 44 | .Sh DESCRIPTION |
| 45 | The | 45 | The |
| 46 | .Fn realpath | 46 | .Fn realpath |
| @@ -53,13 +53,13 @@ and | |||
| 53 | in | 53 | in |
| 54 | .Fa pathname , | 54 | .Fa pathname , |
| 55 | and copies the resulting absolute pathname into the memory referenced by | 55 | and copies the resulting absolute pathname into the memory referenced by |
| 56 | .Fa resolvedname . | 56 | .Fa resolved . |
| 57 | The | 57 | The |
| 58 | .Fa resolvedname | 58 | .Fa resolved |
| 59 | argument | 59 | argument |
| 60 | .Em must | 60 | .Em must |
| 61 | refer to a buffer capable of storing at least | 61 | refer to a buffer capable of storing at least |
| 62 | .Dv MAXPATHLEN | 62 | .Dv PATH_MAX |
| 63 | characters. | 63 | characters. |
| 64 | .Pp | 64 | .Pp |
| 65 | The | 65 | The |
| @@ -76,14 +76,14 @@ is called. | |||
| 76 | The | 76 | The |
| 77 | .Fn realpath | 77 | .Fn realpath |
| 78 | function returns | 78 | function returns |
| 79 | .Fa resolvedname | 79 | .Fa resolved |
| 80 | on success. | 80 | on success. |
| 81 | If an error occurs, | 81 | If an error occurs, |
| 82 | .Fn realpath | 82 | .Fn realpath |
| 83 | returns | 83 | returns |
| 84 | .Dv NULL , | 84 | .Dv NULL , |
| 85 | and | 85 | and |
| 86 | .Fa resolvedname | 86 | .Fa resolved |
| 87 | contains the pathname which caused the problem. | 87 | contains the pathname which caused the problem. |
| 88 | .Sh ERRORS | 88 | .Sh ERRORS |
| 89 | The function | 89 | The function |
| @@ -91,11 +91,7 @@ The function | |||
| 91 | may fail and set the external variable | 91 | may fail and set the external variable |
| 92 | .Va errno | 92 | .Va errno |
| 93 | for any of the errors specified for the library functions | 93 | for any of the errors specified for the library functions |
| 94 | .Xr chdir 2 , | ||
| 95 | .Xr close 2 , | ||
| 96 | .Xr fchdir 2 , | ||
| 97 | .Xr lstat 2 , | 94 | .Xr lstat 2 , |
| 98 | .Xr open 2 , | ||
| 99 | .Xr readlink 2 , | 95 | .Xr readlink 2 , |
| 100 | and | 96 | and |
| 101 | .Xr getcwd 3 . | 97 | .Xr getcwd 3 . |
| @@ -115,6 +111,6 @@ The | |||
| 115 | version always returns absolute pathnames, | 111 | version always returns absolute pathnames, |
| 116 | whereas the Solaris implementation will, | 112 | whereas the Solaris implementation will, |
| 117 | under certain circumstances, return a relative | 113 | under certain circumstances, return a relative |
| 118 | .Fa resolvedname | 114 | .Fa resolved |
| 119 | when given a relative | 115 | when given a relative |
| 120 | .Fa pathname . | 116 | .Fa pathname . |
