summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-10-22 20:01:33 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-10-22 20:01:33 +0200
commit6d90ddf4a8f6263180949345f510a95af2146606 (patch)
treef3144ad5f4cee426cac40d417807496f5f1534d6
parent6a870e98d7f94402e83c02e9d7dfffb15f9013e4 (diff)
document which posix version supports realpath(NULL)
-rw-r--r--hurd/porting/guidelines.mdwn11
1 files changed, 9 insertions, 2 deletions
diff --git a/hurd/porting/guidelines.mdwn b/hurd/porting/guidelines.mdwn
index 33888685..867b78cb 100644
--- a/hurd/porting/guidelines.mdwn
+++ b/hurd/porting/guidelines.mdwn
@@ -140,8 +140,15 @@ for a potential corresponding `PATH_MAX` macro. They are not a replacement for
Note 2: Yes, some POSIX functions such as `realpath()` actually assume that
`PATH_MAX` is defined. This is a bug of the POSIX standard, which got fixed in
-the latest revisions, in which one can simply pass `NULL` to get a dynamically
-allocated buffer.
+POSIX 2001, in which one can simply pass `NULL` to get a dynamically
+allocated buffer. One can thus use:
+
+ #if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
+ char *path = realpath(orig, NULL);
+ #else
+ char path[PATH_MATH];
+ realpath(orig, path);
+ #endif
## <a name="ARG_MAX"> `ARG_MAX` </a>