This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sysconf(_SC_TZNAME_MAX)



Hi,

the AustinDraft writes about TZNAME_MAX:

Maximum number of bytes supported for the name of a timezone (not of the TZ variable).
Minimum Acceptable Value: {_POSIX_TZNAME_MAX}

Our return value of sysconf(_SC_TZNAME_MAX) is wrong, we return 4,
but _POSIX_TZNAME_MAX is defined as 6. if __tzname_max is less than
this, we should return _POSIX_TZNAME_MAX. I propose the following 
patch to fix this:

2001-12-18  Thorsten Kukuk  <kukuk@suse.de>

	* time/tzset.c(__tzname_max): Return at least _POSIX_TZNAME_MAX.

--- time/tzset.c	Fri Jul  6 06:56:23 2001
+++ time/tzset.c	Tue Dec 18 15:13:57 2001
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <limits.h>
 
 
 #define NOID
@@ -405,7 +406,7 @@
 
   __libc_lock_unlock (tzset_lock);
 
-  return __tzname_cur_max;
+  return max(__tzname_cur_max, _POSIX_TZNAME_MAX);
 }
 
 /* Figure out the exact time (as a time_t) in YEAR


-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE GmbH            Deutschherrenstr. 15-19       D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]