diff options
-rw-r--r-- | hurd/porting/guidelines.mdwn | 11 |
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> |