From 88e348d0b5f3b017d1a07341060592623e5b2a4e Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 17 May 2023 22:45:46 +0200 Subject: Add another link about PATH_MAX --- hurd/porting/guidelines.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hurd') diff --git a/hurd/porting/guidelines.mdwn b/hurd/porting/guidelines.mdwn index 21c33488..624f7fd5 100644 --- a/hurd/porting/guidelines.mdwn +++ b/hurd/porting/guidelines.mdwn @@ -132,7 +132,7 @@ If you get Bad File Descriptor error when trying to read from a file (or accessi -Also see +Also see and Every unconditionalized use of `PATH_MAX`, `MAX_PATH` or `MAXPATHLEN` is a POSIX incompatibility. If there is no upper limit on the length of a path (as its the case for GNU), this symbol is not defined in any header file. Instead, you need to either use a different implementation that does not rely on the length of a string or use `sysconf()` to query the length at runtime. If `sysconf()` returns -1, you have to use `realloc()` to allocate the needed memory dynamically. Usually it is thus simpler to just use dynamic allocation. Sometimes the amount is actually known. Else, a geometrically growing loop can be used: for instance, see [Pulseaudio patch](http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=patch-pulse;att=1;bug=522100). Note that in some cases there are GNU extensions that just work fine: when the `__GLIBC__` macro is defined, `getcwd()` calls can be just replaced by `get_current_dir_name()` calls. -- cgit v1.2.3