defensive value for define on Solaris causes load of timerule to fail
Hi, The FILENAME_MAX macro, as used in the local_storage union in localtime.c, has on Solaris the very low/defensive value of 14 (from stdio.h). Please consider using PATH_MAX, from limits.h instead, as that value is (usually) 250 or beyond. Or anything else, that can hold reasonable lengths of file names. Loading zonefiles now fails on Solaris if a filename exceeds the used macro. Regards, Kees
The FILENAME_MAX macro, as used in the local_storage union in localtime.c, has on Solaris the very low/defensive value of 14 (from stdio.h). Please consider using PATH_MAX, from limits.h instead, as that value is (usually) 250 or beyond. Or anything else, that can hold reasonable lengths of file names. Loading zonefiles now fails on Solaris if a filename exceeds the used macro.
Addition: The PATH_MAX macro does not exist on Windows, MAX_PATH does (but requires to include several Windows header files) and FILENAME_MAX is suitable. So, FILENAME_MAX is probably the better choice, but may be, a #if FILENAME_MAX < 260 #undef FILENAME_MAX #define FILENAME_MAX 260 #endif code part is needed? Then FILENAME_MAX is at a defined minimum value (of course, the limit of 260 is also quite an arbitrary choice). Kees
On 12/06/17 12:22, Kees Dekker wrote:
The FILENAME_MAX macro, as used in the local_storage union in localtime.c, has on Solaris the very low/defensive value of 14 (from stdio.h).
Please consider using PATH_MAX, from limits.h instead, as that value is (usually) 250 or beyond. Or anything else, that can hold reasonable lengths of file names.
Loading zonefiles now fails on Solaris if a filename exceeds the usedmacro.
Addition:
The PATH_MAX macro does not exist on Windows, MAX_PATH does (but requires to include several Windows header files) and FILENAME_MAX is suitable.
So, FILENAME_MAX is probably the better choice, but may be, a
#if FILENAME_MAX < 260 #undef FILENAME_MAX #define FILENAME_MAX 260 #endif
code part is needed? Then FILENAME_MAX is at a defined minimum value (of course, the limit of 260 is also quite an arbitrary choice).
I don't like the idea of redefining `FILENAME_MAX`. Just use some reasonably large value of our choosing for the length of `fullname`. Even with a modern GNU/Linux `FILENAME_MAX` value of 4096 (on my system at least), the `fullname` member of `union local_storage` is smaller than the `u` member. -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Web: http://www.mev.co.uk/ )=-
participants (2)
-
Ian Abbott -
Kees Dekker