diff options
| author | jvoisin | 2026-04-01 20:37:02 +0200 |
|---|---|---|
| committer | jvoisin | 2026-04-01 20:37:02 +0200 |
| commit | 60c096eb0433f7573c768a2c8523abd3c11e0720 (patch) | |
| tree | c9ff95ee202cabad323855cb6a9dc72c1778e060 /tests/test_recvfrom_dynamic.c | |
| parent | b35761a1a8378e068fead72f828f2400a20682a8 (diff) | |
Make do even if PATH_MAX isn't defined
As explained in `man realpath(3)`:
> The POSIX.1-2001 standard version of this function is broken by design,
> since it is impossible to determine a suitable size for the output
> buffer, resolved_path. According to POSIX.1-2001 a buffer of size PATH_MAX
> suffices, but PATH_MAX need not be a defined constant, and may have to be
> obtained using pathconf(3). And asking pathconf(3) does not really help,
> since, on the one hand POSIX warns that the result of pathconf(3) may be huge
> and unsuitable for mallocing memory, and on the other hand pathconf(3) may
> return -1 to signify that PATH_MAX is not bounded. The re‐ solved_path
> == NULL feature, not standardized in POSIX.1-2001, but standardized in
> POSIX.1-2008, allows this design problem to be avoided.
So we can either not compile, or be pragmatic, and define PATH_MAX to a sane
value, like 4096, which is the one used on Linux and some/most BSD.
This commit also adds two tests to ensure that things aren't catastrophically
broken by this change.
Diffstat (limited to 'tests/test_recvfrom_dynamic.c')
0 files changed, 0 insertions, 0 deletions
