Sujet : Re: Then there's PATH_MAX
De : fsquared (at) *nospam* fsquared.linux (Farley Flud)
Groupes : comp.os.linux.advocacyDate : 10. Dec 2024, 14:12:03
Autres entêtes
Organisation : UsenetExpress - www.usenetexpress.com
Message-ID : <180fd2f32d5884e5$6049$1734$802601b3@news.usenetexpress.com>
References : 1
User-Agent : Pan/0.146 (Hic habitat felicitas; d7a48b4 gitlab.gnome.org/GNOME/pan.git)
On Mon, 09 Dec 2024 06:09:40 +0000, vallor wrote:
#include <stdio.h>
#include <limits.h>
#ifdef __linux__
#include <linux/limits.h>
#endif
int main (void)
{
printf("%d\n",PATH_MAX);
return 0;
}
This is bullshit.
PATH_MAX is filesystem dependent and since GNU/Linux, unlike that
pile of garbage Microslop, supports many, many different filesystems
the PATH_MAX macro is unreliable and may be undefined on some machines.
The best and only way to determine file name/path parameters is to
use "pathconf" of "fpathconf:"
https://pubs.opengroup.org/onlinepubs/9799919799/From the link:
"The pathconf() function was proposed immediately after the sysconf()
function when it was realized that some configurable values may differ
across file system, directory, or device boundaries."
-- Hail Linux! Hail FOSS! Hail Stallman!