[tz] defensive value for define on Solaris causes load of timerule to fail

Ian Abbott abbotti at mev.co.uk
Mon Jun 12 14:00:44 UTC 2017


On 12/06/17 14:37, Kees Dekker wrote:
>> #if FILENAME_MAX < 260
>> #define TZ_FILENAME_MAX 260
>> #else
>> #define TZ_FILENAME_MAX FILENAME_MAX
>> #endif
>
> Better approach:
>
> #if !defined(FILENAME_MAX) || FILENAME_MAX < 260
> // e.g. Solaris uses a too small value to hold a path
> #define TZ_FILENAME_MAX 260
> #else
> #define TZ_FILENAME_MAX FILENAME_MAX
> #endif
>
> /* Local storage needed for 'tzloadbody'.  */
> union local_storage {
>   /* The file name to be opened.  */
>   char fullname[TZ_FILENAME_MAX + 1];
>
>   /* The results of analyzing the file's contents after it is opened.  */
>   struct {
>     /* The input buffer.  */
>     union input_buffer u;
>
>     /* A temporary state used for parsing a TZ string in the file.  */
>     struct state st;
>   } u;
> };
>

It looks reasonable to me, although checking whether FILENAME_MAX is 
defined is not technically necessary.  I'm sure Paul will code whatever 
seems appropriate!

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the tz mailing list