aboutsummaryrefslogtreecommitdiffstats
path: root/man3/realpath.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/realpath.3')
-rw-r--r--man3/realpath.378
1 files changed, 39 insertions, 39 deletions
diff --git a/man3/realpath.3 b/man3/realpath.3
index 00ccaa3317..3c6ff611e0 100644
--- a/man3/realpath.3
+++ b/man3/realpath.3
@@ -94,6 +94,41 @@ The named file does not exist.
.TP
.B ENOTDIR
A component of the path prefix is not a directory.
+.SH VERSIONS
+On Linux this function appeared in libc 4.5.21.
+.SH "CONFORMING TO"
+4.4BSD, POSIX.1-2001.
+
+In 4.4BSD and Solaris the limit on the pathname length is MAXPATHLEN
+(found in <sys/param.h>).
+SUSv2 prescribes PATH_MAX and
+NAME_MAX, as found in <limits.h> or provided by the
+.BR pathconf (3)
+function.
+A typical source fragment would be
+.LP
+.RS
+.nf
+#ifdef PATH_MAX
+ path_max = PATH_MAX;
+#else
+ path_max = pathconf(path, _PC_PATH_MAX);
+ if (path_max <= 0)
+ path_max = 4096;
+#endif
+.fi
+.RE
+(But see the BUGS section.)
+.LP
+The 4.4BSD, Linux and SUSv2 versions always return an absolute
+pathname.
+Solaris may return a relative pathname when the
+.I path
+argument is relative.
+The prototype of
+.BR realpath ()
+is given in <unistd.h> in libc4 and libc5,
+but in <stdlib.h> everywhere else.
.SH NOTES
The glibc implementation of
.BR realpath ()
@@ -112,6 +147,10 @@ The caller should deallocate this buffer using
.\" Even if we use resolved_path == NULL, then realpath() will still
.\" return ENAMETOOLONG if the resolved pathname would exceed PATH_MAX
.\" bytes -- MTK, Dec 04
+.\" .SH HISTORY
+.\" The
+.\" .BR realpath ()
+.\" function first appeared in 4.4BSD, contributed by Jan-Simon Pendry.
.SH BUGS
Avoid using this function.
It is broken by design since (unless
@@ -138,45 +177,6 @@ may return \-1 to signify that PATH_MAX is not bounded.
The libc4 and libc5 implementation contains a buffer overflow
(fixed in libc-5.4.13).
Thus, set-user-ID programs like mount need a private version.
-.\" .SH HISTORY
-.\" The
-.\" .BR realpath ()
-.\" function first appeared in 4.4BSD, contributed by Jan-Simon Pendry.
-.SH VERSIONS
-On Linux this function appeared in libc 4.5.21.
-.SH "CONFORMING TO"
-4.4BSD, POSIX.1-2001.
-
-In 4.4BSD and Solaris the limit on the pathname length is MAXPATHLEN
-(found in <sys/param.h>).
-SUSv2 prescribes PATH_MAX and
-NAME_MAX, as found in <limits.h> or provided by the
-.BR pathconf (3)
-function.
-A typical source fragment would be
-.LP
-.RS
-.nf
-#ifdef PATH_MAX
- path_max = PATH_MAX;
-#else
- path_max = pathconf(path, _PC_PATH_MAX);
- if (path_max <= 0)
- path_max = 4096;
-#endif
-.fi
-.RE
-(But see the BUGS section.)
-.LP
-The 4.4BSD, Linux and SUSv2 versions always return an absolute
-pathname.
-Solaris may return a relative pathname when the
-.I path
-argument is relative.
-The prototype of
-.BR realpath ()
-is given in <unistd.h> in libc4 and libc5,
-but in <stdlib.h> everywhere else.
.SH "SEE ALSO"
.BR readlink (2),
.BR canonicalize_file_name (3),