Re: [hatari-devel] FILENAME_MAX size?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On 22.5.2022 9.56, Nicolas Pomarède wrote:
Le 22/05/2022 à 01:31, Eero Tamminen a écrit :
According to Glibc docs, FILENAME_MAX should not be used:
https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html

But it's used by Hatari for all configuration file paths...

Any idea whether the documented issue only specific to GNU/Hurd, or can FILENAME_MAX be set to something like MAX_INT also on other platforms?

I'm not aware of such issue, but in that case if we want to be safe, maybe we could just replace FILENAME_MAX by PATH_MAX ?

That would be fine with me, but PATH_MAX ia POSIX, while FILENAME_MAX is in C standard, so I'd rather not change it, unless there actually is a real problem with FILENAME_MAX.

Has anybody tried Hurd, and building Hatari for it?


As PATH_MAX seems to not have this MAX_INT problem, it could solve this issue (PATH_MAX contains the path and the filename, so its size should be enough)

My Glibc headers define both as 4096.


Or we could just set HATARI_FILENAME_MAX = 4096 and use it everywhere.

It could e.g. be fallback if PATH_MAX is missing.


see this page for example for more detailled  informations :

https://stackoverflow.com/questions/65174086/is-there-any-difference-between-filename-max-and-path-max-in-c


	- Eero



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/