diff options
author | Michael Kerrisk <mtk.manpages@gmail.com> | 2007-04-12 22:42:49 +0000 |
---|---|---|
committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2007-04-12 22:42:49 +0000 |
commit | c13182efa3b3d77f2563034c8212c0ca798243ca (patch) | |
tree | e7652b26018b7c22cd6a4e4b41404dfaab911303 /man3/getcwd.3 | |
parent | 4174ff5658082832c2ed511720f18881b3a80a34 (diff) |
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
white space.
Diffstat (limited to 'man3/getcwd.3')
-rw-r--r-- | man3/getcwd.3 | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/man3/getcwd.3 b/man3/getcwd.3 index daad955a..19f826f0 100644 --- a/man3/getcwd.3 +++ b/man3/getcwd.3 @@ -8,7 +8,7 @@ .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. -.\" +.\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from @@ -16,7 +16,7 @@ .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. -.\" +.\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" License. @@ -76,14 +76,15 @@ allocates the buffer dynamically using .BR malloc () if .I buf -is NULL on call. +is NULL on call. In this case, the allocated buffer has the length .I size unless .I size is zero, when .I buf -is allocated as big as necessary. It is possible (and, indeed, +is allocated as big as necessary. +It is possible (and, indeed, advisable) to .BR free () the buffers if they have been obtained this way. @@ -91,7 +92,8 @@ the buffers if they have been obtained this way. .BR get_current_dir_name (), will .BR malloc (3) -an array big enough to hold the current directory name. If the environment +an array big enough to hold the current directory name. +If the environment variable .B PWD is set, and its value is correct, then that value will be returned. @@ -99,7 +101,7 @@ is set, and its value is correct, then that value will be returned. .BR getwd (), does not .BR malloc (3) -any memory. +any memory. The .I buf argument should be a pointer to an array at least @@ -112,7 +114,7 @@ bytes of the actual pathname. Note that .B PATH_MAX need not be a compile-time constant; it may depend on the filesystem -and may even be unlimited. +and may even be unlimited. For portability and security reasons, use of .BR getwd () is deprecated. @@ -122,20 +124,21 @@ on failure with .I errno set accordingly, and .I buf -on success. The contents of the array pointed to by +on success. +The contents of the array pointed to by .IR buf is undefined on error. .SH ERRORS .TP .B EACCES -Permission to read or search a component of the filename was denied. +Permission to read or search a component of the filename was denied. .TP .B EFAULT .IR buf points to a bad address. .TP .B EINVAL -The +The .IR size argument is zero and .IR buf @@ -156,19 +159,21 @@ is a system call (since 2.1.92). On older systems it would query .IR /proc/self/cwd . If both system call and proc file system are missing, a -generic implementation is called. Only in that case can +generic implementation is called. +Only in that case can these calls fail under Linux with .BR EACCES . .LP These functions are often used to save the location of the current working -directory for the purpose of returning to it later. Opening the current +directory for the purpose of returning to it later. +Opening the current directory (".") and calling .BR fchdir (2) to return is usually a faster and more reliable alternative when sufficiently many file descriptors are available, especially on platforms other than Linux. .SH "CONFORMING TO" .BR getcwd() -conforms to POSIX.1-2001. +conforms to POSIX.1-2001. .BR getwd() is present in POSIX.1-2001, but marked LEGACY. .BR get_current_dir_name () |