diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-08-08 21:34:25 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-08-08 21:34:25 +0000 |
commit | a6d1003497d92df2575894474fa1d2c0ee3f39f4 (patch) | |
tree | 6665a936728da87053845bdff9ff812ee58981ec | |
parent | c633e822b473e8135a36e413c5b79d7ce5a5d1fc (diff) | |
download | glibc-a6d1003497d92df2575894474fa1d2c0ee3f39f4.tar glibc-a6d1003497d92df2575894474fa1d2c0ee3f39f4.tar.gz glibc-a6d1003497d92df2575894474fa1d2c0ee3f39f4.tar.bz2 glibc-a6d1003497d92df2575894474fa1d2c0ee3f39f4.zip |
Updated to fedora-glibc-20050808T2126
49 files changed, 796 insertions, 293 deletions
@@ -4,6 +4,128 @@ Shift marked &errno down on big-endian instead of up. * elf/tst-stackguard1.c (do_test): Fix a typo. +2005-08-08 Ulrich Drepper <drepper@redhat.com> + + * nscd/cache.c (cache_add): Commit hash table and header to disk. + + * nscd/mem.c (mempool_alloc): Use posix_fallocate instead of ftruncate. + * nscd/connections.c (nscd_init): Likewise. + +2005-08-08 Jakub Jelinek <jakub@redhat.com> + + * stdio-common/fxprintf.c: Include libioP.h. + + * posix/bits/unistd.h (confstr, getgroups, ttyname_r, gethostname, + getdomainname): Add __NTH. + * stdlib/bits/stdlib.h (ptsname_r, wctomb, mbstowcs, wcstombs): + Likewise. + (realpath): Likewise. Use __const instead of const. Add __restrict + keywords. + * socket/bits/socket2.h (recvfrom): Add __restrict keyword to __buf. + * wcsmbs/bits/wchar2.h (wmemcpy, wmemmove, wmempcpy, wmemset, + wcscpy, wcpcpy, wcsncpy, wcpncpy, wcscat, wcsncat, vswprintf, wcrtomb, + mbsrtowcs, wcsrtombs, mbsnrtowcs, wcsnrtombs): Add __NTH. + * string/bits/string3.h (__memset_ichk): Likewise. + (__memcpy_ichk, __memmove_ichk, __mempcpy_ichk, __strcpy_ichk, + __stpcpy_ichk, __strncpy_ichk, stpncpy, __strcat_ichk, + __strncat_ichk): Likewise. Use __const instead of const. + (__stpncpy_chk): Use __const instead of const. + (__stpncpy_alias): Use __REDIRECT_NTH instead of __REDIRECT. + +2005-08-08 Ulrich Drepper <drepper@redhat.com> + Jakub Jelinek <jakub@redhat.com> + + * nscd/mem.c (BLOCK_ALIGN_LOG, BLOCK_ALIGN, BLOCK_ALIGN_M1): Move + definitions to... + * nscd/nscd.h (BLOCK_ALIGN_LOG, BLOCK_ALIGN, BLOCK_ALIGN_M1): ...here. + * nscd/connections.c (usekey): New enum. + (check_use, verify_persistent_db): New functions. + (nscd_init): If persistent database is corrupted, unlink it and + recreate rather than falling back to non-persistent database. + Call verify_persistent_db. Avoid overflows in total computation. + +2005-08-08 Ulrich Drepper <drepper@redhat.com> + + * iconvdata/utf-16.c (PREPARE_LOOP): Minor cleanups to make code + better readable. Avoid passing var to loop function, it's not + necessary at all. + +2005-08-07 Ulrich Drepper <drepper@redhat.com> + + * elf/elf.h (DT_ALPHA_PLTRO): Use symbolic name in DT_ALPHA_PLTRO + definition. + +2005-08-05 Ulrich Drepper <drepper@redhat.com> + + * timezone/checktab.awk: Update from tzcode2005k. + * timezone/private.h: Likewise. + * timezone/scheck.c: Likewise. + * timezone/tzselect.ksh: Likewise. + * timezone/zdump.c: Likewise. + * timezone/zic.c: Likewise. + * timezone/africa: Update from tzdata2005k. + * timezone/antarctica: Likewise. + * timezone/asia: Likewise. + * timezone/australasia: Likewise. + * timezone/europe: Likewise. + * timezone/iso3166.tab: Likewise. + * timezone/leapseconds: Likewise. + * timezone/northamerica: Likewise. + * timezone/solar87: Likewise. + * timezone/solar88: Likewise. + * timezone/solar89: Likewise. + * timezone/southamerica: Likewise. + * timezone/zone.tab: Likewise. + +2005-08-05 Roland McGrath <roland@redhat.com> + + * mach/shortcut.awk: Ignore `weak_alias' lines. + Reported by Alfred M. Szmidt <ams@gnu.org>. + + * sysdeps/mach/hurd/mig-reply.c (reply_port): Don't use ?: as lvalue. + Reported by Alfred M. Szmidt <ams@gnu.org>. + +2005-08-03 Dwayne Grant McConnell <dgm69@us.ibm.com> + + * sysdeps/powerpc/powerpc32/Makefile (CFLAGS-initfini.s): + Use +=, not =, to append. Remove duplicate flags. + * sysdeps/powerpc/powerpc64/Makefile (CFLAGS-initfini.s): + Likewise. Fix comments. + +2005-08-01 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Restart system + call if it returned EINTR. + +2005-07-31 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/x86_64/dl-machine.h (elf_machine_load_address): Move + helper variable into .data.rel.ro. Simplify the code. Extend + comment to explain prelinking. + +2005-07-31 Andreas Jaeger <aj@suse.de> + + * include/bits/syslog.h: New file. + +2005-07-30 Ulrich Drepper <drepper@redhat.com> + + * elf/dl-load.c [__WORDSIZE==64] (FILEBUF_SIZE): Adjust the value + up. We have more program header entries now and the note section + was normally not loaded. + + * nis/nis_subr.c: Some minor code cleanups. + +2005-07-29 Ulrich Drepper <drepper@redhat.com> + + * misc/bits/syslog.h: New file. + * misc/sys/syslog.h: Include <bits/syslog.h> for fortification. + * misc/Makefile (headers): Add bits/syslog.h. + * include/sys/syslog.h: Add __vsyslog_chk prototype and hidden_proto. + * sysdeps/generic/syslog.c: Change vsyslog function to __vsyslog_chk. + Call __vfprintf_chk if necessary. Make vsyslog a wrapper. Add + __syslog_chk. + * misc/Versions: Export __syslog_chk and __vsyslog_chk. + 2005-07-29 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/dl-osinfo.h: Include errno.h, hp-timing.h, @@ -17,11 +139,13 @@ 2005-07-28 Thomas Schwinge <schwinge@nic-nac-project.de> + [BZ #1137] * misc/error.c [_LIBC]: Include <stdbool.h> and <stdint.h>. 2005-07-28 Ulrich Drepper <drepper@redhat.com> - * nis/nis_xdr.c: Help gcc to generate unnecessary wrapper functions. + * nis/nis_xdr.c: Help gcc to avoid generating unnecessary wrapper + functions. 2005-07-28 Jakub Jelinek <jakub@redhat.com> @@ -121,6 +245,7 @@ 2005-07-20 Ulrich Drepper <drepper@redhat.com> + [BZ #1138] * sysdeps/x86_64/fpu/libm-test-ulps: Adjust expected atan2f results. * sysdeps/powerpc/fpu/libm-test-ulps: Likewise. * sysdeps/s390/fpu/libm-test-ulps: Likewise. @@ -128,6 +253,7 @@ 2005-07-20 Bob Wilson <bob.wilson@acm.org> Darin Petkov <darin@tensilica.com> + [BZ #1138] * sysdeps/ieee754/flt-32/e_atan2f.c (pi_lo): Correct exponent value. 2005-07-20 Jakub Jelinek <jakub@redhat.com> @@ -215,6 +341,7 @@ * sunrpc/xdr_ref.c: Likewise. * sysdeps/generic/wordexp.c: Likewise. + [BZ #1137] * misc/Makefile: Add rules to build and run tst-error1. * misc/tst-error1.c: New file. * misc/error.c: Fix memory leak and possibly endless loop. diff --git a/elf/dl-load.c b/elf/dl-load.c index d8b3a56d0d..677174d036 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -122,19 +122,19 @@ int __stack_prot attribute_hidden attribute_relro question is how large are the ELF and program header combined. The ELF header 32-bit files is 52 bytes long and in 64-bit files is 64 bytes long. Each program header entry is again 32 and 56 bytes - long respectively. I.e., even with a file which has 7 program - header entries we only have to read 512B. Add to this a bit of - margin for program notes and reading 512B and 640B for 32-bit and - 64-bit files respecitvely is enough. If this heuristic should - really fail for some file the code in `_dl_map_object_from_fd' - knows how to recover. */ + long respectively. I.e., even with a file which has 10 program + header entries we only have to read 372B/624B respectively. Add to + this a bit of margin for program notes and reading 512B and 832B + for 32-bit and 64-bit files respecitvely is enough. If this + heuristic should really fail for some file the code in + `_dl_map_object_from_fd' knows how to recover. */ struct filebuf { ssize_t len; #if __WORDSIZE == 32 # define FILEBUF_SIZE 512 #else -# define FILEBUF_SIZE 640 +# define FILEBUF_SIZE 832 #endif char buf[FILEBUF_SIZE] __attribute__ ((aligned (__alignof (ElfW(Ehdr))))); }; @@ -1867,7 +1867,7 @@ typedef Elf32_Addr Elf32_Conflict; #define LITUSE_ALPHA_TLS_LDM 5 /* Legal values for d_tag of Elf64_Dyn. */ -#define DT_ALPHA_PLTRO 0x70000000 +#define DT_ALPHA_PLTRO (DT_LOPROC + 0) #define DT_ALPHA_NUM 1 /* PowerPC specific declarations */ diff --git a/fedora/branch.mk b/fedora/branch.mk index 989c0d7e3c..34b90fb2b7 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-fc4 -fedora-sync-date := 2005-07-29 15:31 UTC -fedora-sync-tag := fedora-glibc-20050729T1531 +fedora-sync-date := 2005-08-08 21:26 UTC +fedora-sync-tag := fedora-glibc-20050808T2126 diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c index 6b0dd9c8f5..7f6c760900 100644 --- a/iconvdata/utf-16.c +++ b/iconvdata/utf-16.c @@ -1,5 +1,5 @@ /* Conversion module for UTF-16. - Copyright (C) 1999, 2000-2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000-2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. @@ -44,10 +44,9 @@ #define PREPARE_LOOP \ enum direction dir = ((struct utf16_data *) step->__data)->dir; \ enum variant var = ((struct utf16_data *) step->__data)->var; \ - int swap; \ - if (FROM_DIRECTION && var == UTF_16) \ + if (__builtin_expect (data->__invocation_counter == 0, 0) && var == UTF_16) \ { \ - if (data->__invocation_counter == 0) \ + if (FROM_DIRECTION) \ { \ /* We have to find out which byte order the file is encoded in. */ \ if (inptr + 2 > inend) \ @@ -63,19 +62,18 @@ *inptrp = inptr += 2; \ } \ } \ - } \ - else if (!FROM_DIRECTION && var == UTF_16 && !data->__internal_use \ - && data->__invocation_counter == 0) \ - { \ - /* Emit the Byte Order Mark. */ \ - if (__builtin_expect (outbuf + 2 > outend, 0)) \ - return __GCONV_FULL_OUTPUT; \ + else if (!FROM_DIRECTION && !data->__internal_use) \ + { \ + /* Emit the Byte Order Mark. */ \ + if (__builtin_expect (outbuf + 2 > outend, 0)) \ + return __GCONV_FULL_OUTPUT; \ \ - put16u (outbuf, BOM); \ - outbuf += 2; \ + put16u (outbuf, BOM); \ + outbuf += 2; \ + } \ } \ - swap = ((struct utf16_data *) step->__data)->swap; -#define EXTRA_LOOP_ARGS , var, swap + int swap = ((struct utf16_data *) step->__data)->swap; +#define EXTRA_LOOP_ARGS , swap /* Direction of the transformation. */ @@ -267,7 +265,7 @@ gconv_end (struct __gconv_step *data) } #define LOOP_NEED_FLAGS #define EXTRA_LOOP_DECLS \ - , enum variant var, int swap + , int swap #include <iconv/loop.c> @@ -328,8 +326,6 @@ gconv_end (struct __gconv_step *data) } \ else \ { \ - uint16_t u2; \ - \ /* It's a surrogate character. At least the first word says \ it is. */ \ if (__builtin_expect (inptr + 4 > inend, 0)) \ @@ -341,7 +337,7 @@ gconv_end (struct __gconv_step *data) } \ \ inptr += 2; \ - u2 = get16 (inptr); \ + uint16_t u2 = get16 (inptr); \ if (__builtin_expect (u2 < 0xdc00, 0) \ || __builtin_expect (u2 > 0xdfff, 0)) \ { \ @@ -358,7 +354,7 @@ gconv_end (struct __gconv_step *data) } #define LOOP_NEED_FLAGS #define EXTRA_LOOP_DECLS \ - , enum variant var, int swap + , int swap #include <iconv/loop.c> diff --git a/include/bits/syslog.h b/include/bits/syslog.h new file mode 100644 index 0000000000..060b893482 --- /dev/null +++ b/include/bits/syslog.h @@ -0,0 +1 @@ +#include <misc/bits/syslog.h> diff --git a/include/sys/syslog.h b/include/sys/syslog.h index e018225333..8b0d59dad6 100644 --- a/include/sys/syslog.h +++ b/include/sys/syslog.h @@ -2,3 +2,8 @@ libc_hidden_proto (syslog) libc_hidden_proto (vsyslog) + +extern void __vsyslog_chk (int __pri, int __flag, __const char *__fmt, + __gnuc_va_list __ap) + __attribute__ ((__format__ (__printf__, 3, 0))); +libc_hidden_proto (__vsyslog_chk) diff --git a/localedata/ChangeLog b/localedata/ChangeLog index ae43622e15..c456ec6ed5 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -5,7 +5,7 @@ 2005-07-08 Ulrich Drepper <drepper@redhat.com> - [BZ #408] + [BZ #448] * locales/vi_VN: Update locale. 2005-07-05 Ulrich Drepper <drepper@redhat.com> @@ -266,6 +266,7 @@ 2004-10-04 Ulrich Drepper <drepper@redhat.com> + [BZ #413] * locales/gu_IN: Update various incorrect and missing information. Patch by Ankit Patel <ankit@redhat.com>. diff --git a/mach/shortcut.awk b/mach/shortcut.awk index 1857998122..ea283d49ba 100644 --- a/mach/shortcut.awk +++ b/mach/shortcut.awk @@ -7,6 +7,8 @@ BEGIN { print "/* This file is generated by shortcut.awk. */"; $1 == "LINTLIBRARY" { print "#include <mach.h>"; next } +$1 == "weak_alias" { next } + # Copy the first line of the definition, but # replace the function name (RPC) with CALL. $NF == rpc \ diff --git a/misc/Makefile b/misc/Makefile index cd5b64e7ab..7c0b64818d 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -29,7 +29,7 @@ headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \ sys/mman.h sys/param.h fstab.h mntent.h search.h err.h error.h \ sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \ sys/select.h ustat.h sys/ustat.h bits/ustat.h sys/sysinfo.h \ - regexp.h bits/select.h bits/mman.h sys/xattr.h + regexp.h bits/select.h bits/mman.h sys/xattr.h bits/syslog.h routines := brk sbrk sstk ioctl \ readv writev \ diff --git a/misc/Versions b/misc/Versions index 13b38eec72..4c3aafad6e 100644 --- a/misc/Versions +++ b/misc/Versions @@ -130,4 +130,7 @@ libc { GLIBC_2.3.3 { remap_file_pages; } + GLIBC_2.4 { + __syslog_chk; __vsyslog_chk; + } } diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h new file mode 100644 index 0000000000..c0427214e3 --- /dev/null +++ b/misc/bits/syslog.h @@ -0,0 +1,39 @@ +/* Checking macros for syslog functions. + Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SYSLOG_H +# error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead." +#endif + + +extern void __syslog_chk (int __pri, int __flag, __const char *__fmt, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); + +#define syslog(pri, ...) \ + __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) + + +#ifdef __USE_BSD +extern void __vsyslog_chk (int __pri, int __flag, __const char *__fmt, + __gnuc_va_list __ap) + __attribute__ ((__format__ (__printf__, 3, 0))); + +# define vsyslog(pri, fmt, ap) \ + __vsyslog_chk (pri, __USE_FORTIFY_LEVEL - 1, fmt, ap) +#endif diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h index 5007525d85..9de7570d8a 100644 --- a/misc/sys/syslog.h +++ b/misc/sys/syslog.h @@ -188,7 +188,7 @@ extern int setlogmask (int __mask) __THROW; This function is a possible cancellation point and therefore not marked with __THROW. */ extern void syslog (int __pri, __const char *__fmt, ...) - __attribute__ ((__format__(__printf__, 2, 3))); + __attribute__ ((__format__ (__printf__, 2, 3))); #ifdef __USE_BSD /* Generate a log message using FMT and using arguments pointed to by AP. @@ -198,7 +198,13 @@ extern void syslog (int __pri, __const char *__fmt, ...) or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap) - __attribute__ ((__format__(__printf__, 2, 0))); + __attribute__ ((__format__ (__printf__, 2, 0))); +#endif + + +/* Define some macros helping to catch buffer overflows. */ +#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus +# include <bits/syslog.h> #endif __END_DECLS diff --git a/nis/nis_subr.c b/nis/nis_subr.c index 4c4ef8b5b4..5838e30e88 100644 --- a/nis/nis_subr.c +++ b/nis/nis_subr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1999, 2000, 2004 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1999, 2000, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -39,22 +39,13 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen) while (name[i] != '.' && name[i] != '\0') i++; - if (i > buflen - 1) + if (__builtin_expect (i > buflen - 1, 0)) { __set_errno (ERANGE); return NULL; } - if (i > 0) - { - if ((size_t)i >= buflen) - { - __set_errno (ERANGE); - return NULL; - } - - *((char *) __mempcpy (buffer, name, i)) = '\0'; - } + *((char *) __mempcpy (buffer, name, i)) = '\0'; return buffer; } @@ -98,13 +89,12 @@ nis_name_of_r (const_nis_name name, char *buffer, size_t buflen) } libnsl_hidden_def (nis_name_of_r) -static int +static int __always_inline count_dots (const_nis_name str) { int count = 0; - size_t l = strlen (str); - for (size_t i = 0; i < l; ++i) + for (size_t i = 0; str[i] != '\0'; ++i) if (str[i] == '.') ++count; diff --git a/nscd/cache.c b/nscd/cache.c index efac4b3bcc..800b7ecf27 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 1999, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (c) 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -169,6 +169,12 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet, if (nentries > table->head->maxnentries) table->head->maxnentries = nentries; + if (table->persistent) + // XXX async OK? + msync ((void *) table->head, + (char *) &table->head->array[hash] - (char *) table->head + + sizeof (ref_t), MS_ASYNC); + return 0; } diff --git a/nscd/connections.c b/nscd/connections.c index d18851f828..42a36d39c0 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -199,6 +199,210 @@ writeall (int fd, const void *buf, size_t len) } +enum usekey + { + use_not = 0, + /* The following three are not really used, they are symbolic constants. */ + use_first = 16, + use_begin = 32, + use_end = 64, + + use_he = 1, + use_he_begin = use_he | use_begin, + use_he_end = use_he | use_end, +#if SEPARATE_KEY + use_key = 2, + use_key_begin = use_key | use_begin, + use_key_end = use_key | use_end, + use_key_first = use_key_begin | use_first, +#endif + use_data = 3, + use_data_begin = use_data | use_begin, + use_data_end = use_data | use_end, + use_data_first = use_data_begin | use_first + }; + + +static int +check_use (const char *data, nscd_ssize_t first_free, uint8_t *usemap, + enum usekey use, ref_t start, size_t len) +{ + assert (len >= 2); + + if (start > first_free || start + len > first_free + || (start & BLOCK_ALIGN_M1)) + return 0; + + if (usemap[start] == use_not) + { + /* Add the start marker. */ + usemap[start] = use | use_begin; + use &= ~use_first; + + while (--len > 0) + if (usemap[++start] != use_not) + return 0; + else + usemap[start] = use; + + /* Add the end marker. */ + usemap[start] = use | use_end; + } + else if ((usemap[start] & ~use_first) == ((use | use_begin) & ~use_first)) + { + /* Hash entries can't be shared. */ + if (use == use_he) + return 0; + + usemap[start] |= (use & use_first); + use &= ~use_first; + + while (--len > 1) + if (usemap[++start] != use) + return 0; + + if (usemap[++start] != (use | use_end)) + return 0; + } + else + /* Points to a wrong object or somewhere in the middle. */ + return 0; + + return 1; +} + + +/* Verify data in persistent database. */ +static int +verify_persistent_db (void *mem, struct database_pers_head *readhead, int dbnr) +{ + assert (dbnr == pwddb || dbnr == grpdb || dbnr == hstdb); + + time_t now = time (NULL); + + struct database_pers_head *head = mem; + struct database_pers_head head_copy = *head; + + /* Check that the header that was read matches the head in the database. */ + if (readhead != NULL && memcmp (head, readhead, sizeof (*head)) != 0) + return 0; + + /* First some easy tests: make sure the database header is sane. */ + if (head->version != DB_VERSION + || head->header_size != sizeof (*head) + /* We allow a timestamp to be one hour ahead of the current time. + This should cover daylight saving time changes. */ + || head->timestamp > now + 60 * 60 + 60 + || (head->gc_cycle & 1) + || (size_t) head->module > INT32_MAX / sizeof (ref_t) + || (size_t) head->data_size > INT32_MAX - head->module * sizeof (ref_t) + || head->first_free < 0 + || head->first_free > head->data_size + || (head->first_free & BLOCK_ALIGN_M1) != 0 + || head->maxnentries < 0 + || head->maxnsearched < 0) + return 0; + + uint8_t *usemap = calloc (head->first_free, 1); + if (usemap == NULL) + return 0; + + const char *data = (char *) &head->array[roundup (head->module, + ALIGN / sizeof (ref_t))]; + + nscd_ssize_t he_cnt = 0; + for (nscd_ssize_t cnt = 0; cnt < head->module; ++cnt) + { + ref_t work = head->array[cnt]; + + while (work != ENDREF) + { + if (! check_use (data, head->first_free, usemap, use_he, work, + sizeof (struct hashentry))) + goto fail; + + /* Now we know we can dereference the record. */ + struct hashentry *here = (struct hashentry *) (data + work); + + ++he_cnt; + + /* Make sure the record is for this type of service. */ + if (here->type >= LASTREQ + || serv2db[here->type] != &dbs[dbnr]) + goto fail; + + /* Validate boolean field value. */ + if (here->first != false && here->first != true) + goto fail; + + if (here->len < 0) + goto fail; + + /* Now the data. */ + if (here->packet < 0 + || here->packet > head->first_free + || here->packet + sizeof (struct datahead) > head->first_free) + goto fail; + + struct datahead *dh = (struct datahead *) (data + here->packet); + + if (! check_use (data, head->first_free, usemap, + use_data | (here->first ? use_first : 0), + here->packet, dh->allocsize)) + goto fail; + + if (dh->allocsize < sizeof (struct datahead) + || dh->recsize > dh->allocsize + || (dh->notfound != false && dh->notfound != true) + || (dh->usable != false && dh->usable != true)) + goto fail; + + if (here->key < here->packet + sizeof (struct datahead) + || here->key > here->packet + dh->allocsize + || here->key + here->len > here->packet + dh->allocsize) + { +#if SEPARATE_KEY + /* If keys can appear outside of data, this should be done + instead. But gc doesn't mark the data in that case. */ + if (! check_use (data, head->first_free, usemap, + use_key | (here->first ? use_first : 0), + here->key, here->len)) +#endif + goto fail; + } + + work = here->next; + } + } + + if (he_cnt != head->nentries) + goto fail; + + /* See if all data and keys had at least one reference from + he->first == true hashentry. */ + for (ref_t idx = 0; idx < head->first_free; ++idx) + { +#if SEPARATE_KEY + if (usemap[idx] == use_key_begin) + goto fail; +#endif + if (usemap[idx] == use_data_begin) + goto fail; + } + + /* Finally, make sure the database hasn't changed since the first test. */ + if (memcmp (mem, &head_copy, sizeof (*head)) != 0) + goto fail; + + free (usemap); + return 1; + +fail: + free (usemap); + return 0; +} + + /* Initialize database information structures. */ void nscd_init (void) @@ -242,7 +446,7 @@ nscd_init (void) fail_db: dbg_log (_("invalid persistent database file \"%s\": %s"), dbs[cnt].db_filename, strerror (errno)); - dbs[cnt].persistent = 0; + unlink (dbs[cnt].db_filename); } else if (head.module == 0 && head.data_size == 0) { @@ -255,22 +459,31 @@ nscd_init (void) dbg_log (_("invalid persistent database file \"%s\": %s"), dbs[cnt].db_filename, _("header size does not match")); - dbs[cnt].persistent = 0; + unlink (dbs[cnt].db_filename); } else if ((total = (sizeof (head) + roundup (head.module * sizeof (ref_t), ALIGN) + head.data_size)) - > st.st_size) + > st.st_size + || total < sizeof (head)) { dbg_log (_("invalid persistent database file \"%s\": %s"), dbs[cnt].db_filename, _("file size does not match")); - dbs[cnt].persistent = 0; + unlink (dbs[cnt].db_filename); } else if ((mem = mmap (NULL, total, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) goto fail_db; + else if (!verify_persistent_db (mem, &head, cnt)) + { + munmap (mem, total); + dbg_log (_("invalid persistent database file \"%s\": %s"), + dbs[cnt].db_filename, + _("verification failed")); + unlink (dbs[cnt].db_filename); + } else { /* Success. We have the database. */ @@ -425,7 +638,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"), if ((TEMP_FAILURE_RETRY (write (fd, &head, sizeof (head))) != sizeof (head)) - || ftruncate (fd, total) != 0 + || posix_fallocate (fd, 0, total) != 0 || (mem = mmap (NULL, total, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) { diff --git a/nscd/mem.c b/nscd/mem.c index c3a0f96702..823eda1019 100644 --- a/nscd/mem.c +++ b/nscd/mem.c @@ -1,5 +1,5 @@ /* Cache memory handling. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. @@ -21,6 +21,7 @@ #include <assert.h> #include <errno.h> #include <error.h> +#include <fcntl.h> #include <inttypes.h> #include <libintl.h> #include <limits.h> @@ -34,12 +35,6 @@ #include "nscd.h" -/* Maximum alignment requirement we will encounter. */ -#define BLOCK_ALIGN_LOG 3 -#define BLOCK_ALIGN (1 << BLOCK_ALIGN_LOG) -#define BLOCK_ALIGN_M1 (BLOCK_ALIGN - 1) - - static int sort_he (const void *p1, const void *p2) { @@ -194,7 +189,7 @@ gc (struct database_dyn *db) highref -= BLOCK_ALIGN; } - /* No we can iterate over the MARK array and find bits which are not + /* Now we can iterate over the MARK array and find bits which are not set. These represent memory which can be recovered. */ size_t byte = 0; /* Find the first gap. */ @@ -494,7 +489,8 @@ mempool_alloc (struct database_dyn *db, size_t len) + db->head->module * sizeof (ref_t) + new_data_size); - if ((!db->mmap_used || ftruncate (db->wr_fd, newtotal) != 0) + if ((!db->mmap_used + || posix_fallocate (db->wr_fd, oldtotal, newtotal) != 0) /* Try to resize the mapping. Note: no MREMAP_MAYMOVE. */ && mremap (db->head, oldtotal, newtotal, 0) == 0) { diff --git a/nscd/nscd.h b/nscd/nscd.h index d5dc613d22..25a4b38eb4 100644 --- a/nscd/nscd.h +++ b/nscd/nscd.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004 +/* Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998. @@ -94,6 +94,11 @@ struct database_dyn /* Path used when not using persistent storage. */ #define _PATH_NSCD_XYZ_DB_TMP "/var/run/nscd/dbXXXXXX" +/* Maximum alignment requirement we will encounter. */ +#define BLOCK_ALIGN_LOG 3 +#define BLOCK_ALIGN (1 << BLOCK_ALIGN_LOG) +#define BLOCK_ALIGN_M1 (BLOCK_ALIGN - 1) + /* Global variables. */ extern struct database_dyn dbs[lastdb]; diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index b6c756a9de..b72b7c758a 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -135,7 +135,7 @@ extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf, size_t __len), confstr); extern __always_inline size_t -confstr (int __name, char *__buf, size_t __len) +__NTH (confstr (int __name, char *__buf, size_t __len)) { if (__bos (__buf) != (size_t) -1 && (!__builtin_constant_p (__len) || __bos (__buf) < __len)) @@ -150,7 +150,7 @@ extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]), getgroups) __wur; extern __always_inline int -getgroups (int __size, __gid_t __list[]) +__NTH (getgroups (int __size, __gid_t __list[])) { if (__bos (__list) != (size_t) -1 && (!__builtin_constant_p (__size) @@ -167,7 +167,7 @@ extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf, __nonnull ((2)); extern __always_inline int -ttyname_r (int __fd, char *__buf, size_t __buflen) +__NTH (ttyname_r (int __fd, char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1 && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf))) @@ -200,7 +200,7 @@ extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen), gethostname) __nonnull ((1)); extern __always_inline int -gethostname (char *__buf, size_t __buflen) +__NTH (gethostname (char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1 && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf))) @@ -218,7 +218,7 @@ extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf, getdomainname) __nonnull ((1)) __wur; extern __always_inline int -getdomainname (char *__buf, size_t __buflen) +__NTH (getdomainname (char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1 && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf))) diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h index a88c1545dd..2543ea37d4 100644 --- a/socket/bits/socket2.h +++ b/socket/bits/socket2.h @@ -45,7 +45,7 @@ extern ssize_t __REDIRECT (__recvfrom_alias, socklen_t *__restrict __addr_len), recvfrom); extern __always_inline ssize_t -recvfrom (int __fd, void *__buf, size_t __n, int __flags, +recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) { if (__bos0 (__buf) != (size_t) -1 diff --git a/stdio-common/fxprintf.c b/stdio-common/fxprintf.c index ff6a98e94b..f6ba0ca558 100644 --- a/stdio-common/fxprintf.c +++ b/stdio-common/fxprintf.c @@ -23,6 +23,7 @@ #include <stdio.h> #include <wchar.h> #include <string.h> +#include <libioP.h> int diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h index 9ff8f622e2..9e2519dcfc 100644 --- a/stdlib/bits/stdlib.h +++ b/stdlib/bits/stdlib.h @@ -29,7 +29,7 @@ extern char *__REDIRECT_NTH (__realpath_alias, char *__restrict __resolved), realpath) __wur; extern __always_inline __wur char * -realpath (const char *__name, char *__resolved) +__NTH (realpath (__const char *__restrict __name, char *__restrict __resolved)) { if (__bos (__resolved) != (size_t) -1) return __realpath_chk (__name, __resolved, __bos (__resolved)); @@ -45,7 +45,7 @@ extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf, __nonnull ((2)); extern __always_inline int -ptsname_r (int __fd, char *__buf, size_t __buflen) +__NTH (ptsname_r (int __fd, char *__buf, size_t __buflen)) { if (__bos (__buf) != (size_t) -1 && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf))) @@ -60,7 +60,7 @@ extern int __REDIRECT_NTH (__wctomb_alias, (char *__s, wchar_t __wchar), wctomb) __wur; extern __always_inline __wur int -wctomb (char *__s, wchar_t __wchar) +__NTH (wctomb (char *__s, wchar_t __wchar)) { /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. But this would only disturb the namespace. So we define our own @@ -84,8 +84,8 @@ extern size_t __REDIRECT_NTH (__mbstowcs_alias, size_t __len), mbstowcs); extern __always_inline size_t -mbstowcs (wchar_t *__restrict __dst, __const char *__restrict __src, - size_t __len) +__NTH (mbstowcs (wchar_t *__restrict __dst, __const char *__restrict __src, + size_t __len)) { if (__bos (__dst) != (size_t) -1 && (!__builtin_constant_p (__len) @@ -104,8 +104,8 @@ extern size_t __REDIRECT_NTH (__wcstombs_alias, size_t __len), wcstombs); extern __always_inline size_t -wcstombs (char *__restrict __dst, __const wchar_t *__restrict __src, - size_t __len) +__NTH (wcstombs (char *__restrict __dst, __const wchar_t *__restrict __src, + size_t __len)) { if (__bos (__dst) != (size_t) -1 && (!__builtin_constant_p (__len) || __len > __bos (__dst))) diff --git a/string/bits/string3.h b/string/bits/string3.h index 8da73ffde2..041ac11259 100644 --- a/string/bits/string3.h +++ b/string/bits/string3.h @@ -45,8 +45,8 @@ ? __builtin___memcpy_chk (dest, src, len, __bos0 (dest)) \ : __memcpy_ichk (dest, src, len)) static __always_inline void * -__memcpy_ichk (void *__restrict __dest, const void *__restrict __src, - size_t __len) +__NTH (__memcpy_ichk (void *__restrict __dest, __const void *__restrict __src, + size_t __len)) { return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); } @@ -57,7 +57,7 @@ __memcpy_ichk (void *__restrict __dest, const void *__restrict __src, ? __builtin___memmove_chk (dest, src, len, __bos0 (dest)) \ : __memmove_ichk (dest, src, len)) static __always_inline void * -__memmove_ichk (void *__dest, const void *__src, size_t __len) +__NTH (__memmove_ichk (void *__dest, __const void *__src, size_t __len)) { return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); } @@ -69,8 +69,8 @@ __memmove_ichk (void *__dest, const void *__src, size_t __len) ? __builtin___mempcpy_chk (dest, src, len, __bos0 (dest)) \ : __mempcpy_ichk (dest, src, len)) static __always_inline void * -__mempcpy_ichk (void *__restrict __dest, const void *__restrict __src, - size_t __len) +__NTH (__mempcpy_ichk (void *__restrict __dest, + __const void *__restrict __src, size_t __len)) { return __builtin___mempcpy_chk (__dest, __src, __len, __bos0 (__dest)); } @@ -91,7 +91,7 @@ __warndecl (__warn_memset_zero_len, ? __builtin___memset_chk (dest, ch, len, __bos0 (dest)) \ : __memset_ichk (dest, ch, len))) static __always_inline void * -__memset_ichk (void *__dest, int __ch, size_t __len) +__NTH (__memset_ichk (void *__dest, int __ch, size_t __len)) { return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); } @@ -113,7 +113,7 @@ __memset_ichk (void *__dest, int __ch, size_t __len) ? __builtin___strcpy_chk (dest, src, __bos (dest)) \ : __strcpy_ichk (dest, src)) static __always_inline char * -__strcpy_ichk (char *__restrict __dest, const char *__restrict __src) +__NTH (__strcpy_ichk (char *__restrict __dest, __const char *__restrict __src)) { return __builtin___strcpy_chk (__dest, __src, __bos (__dest)); } @@ -125,7 +125,7 @@ __strcpy_ichk (char *__restrict __dest, const char *__restrict __src) ? __builtin___stpcpy_chk (dest, src, __bos (dest)) \ : __stpcpy_ichk (dest, src)) static __always_inline char * -__stpcpy_ichk (char *__restrict __dest, const char *__restrict __src) +__NTH (__stpcpy_ichk (char *__restrict __dest, __const char *__restrict __src)) { return __builtin___stpcpy_chk (__dest, __src, __bos (__dest)); } @@ -137,21 +137,22 @@ __stpcpy_ichk (char *__restrict __dest, const char *__restrict __src) ? __builtin___strncpy_chk (dest, src, len, __bos (dest)) \ : __strncpy_ichk (dest, src, len)) static __always_inline char * -__strncpy_ichk (char *__restrict __dest, const char *__restrict __src, - size_t __len) +__NTH (__strncpy_ichk (char *__restrict __dest, __const char *__restrict __src, + size_t __len)) { return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); } // XXX We have no corresponding builtin yet. -extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n, +extern char *__stpncpy_chk (char *__dest, __const char *__src, size_t __n, size_t __destlen) __THROW; -extern char *__REDIRECT (__stpncpy_alias, (char *__dest, const char *__src, - size_t __n), stpncpy) __THROW; +extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, + __const char *__src, + size_t __n), stpncpy); extern __always_inline char * -stpncpy (char *__dest, const char *__src, size_t __n) +__NTH (stpncpy (char *__dest, __const char *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1 && (!__builtin_constant_p (__n) || __n <= __bos (__dest))) @@ -165,7 +166,7 @@ stpncpy (char *__dest, const char *__src, size_t __n) ? __builtin___strcat_chk (dest, src, __bos (dest)) \ : __strcat_ichk (dest, src)) static __always_inline char * -__strcat_ichk (char *__restrict __dest, const char *__restrict __src) +__NTH (__strcat_ichk (char *__restrict __dest, __const char *__restrict __src)) { return __builtin___strcat_chk (__dest, __src, __bos (__dest)); } @@ -176,8 +177,8 @@ __strcat_ichk (char *__restrict __dest, const char *__restrict __src) ? __builtin___strncat_chk (dest, src, len, __bos (dest)) \ : __strncat_ichk (dest, src, len)) static __always_inline char * -__strncat_ichk (char *__restrict __dest, const char *__restrict __src, - size_t __len) +__NTH (__strncat_ichk (char *__restrict __dest, __const char *__restrict __src, + size_t __len)) { return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest)); } diff --git a/sysdeps/generic/syslog.c b/sysdeps/generic/syslog.c index 9c8f422aad..9c5597f5aa 100644 --- a/sysdeps/generic/syslog.c +++ b/sysdeps/generic/syslog.c @@ -108,32 +108,28 @@ cancel_handler (void *ptr) * print message on log file; output is intended for syslogd(8). */ void -#if __STDC__ syslog(int pri, const char *fmt, ...) -#else -syslog(pri, fmt, va_alist) - int pri; - char *fmt; - va_dcl -#endif { va_list ap; -#if __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif - vsyslog(pri, fmt, ap); + __vsyslog_chk(pri, -1, fmt, ap); va_end(ap); } libc_hidden_def (syslog) void -vsyslog(pri, fmt, ap) - int pri; - register const char *fmt; +__syslog_chk(int pri, int flag, const char *fmt, ...) +{ va_list ap; + + va_start(ap, fmt); + __vsyslog_chk(pri, flag, fmt, ap); + va_end(ap); +} + +void +__vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) { struct tm now_tm; time_t now; @@ -218,7 +214,10 @@ vsyslog(pri, fmt, ap) /* We have the header. Print the user's format into the buffer. */ - vfprintf (f, fmt, ap); + if (flag == -1) + vfprintf (f, fmt, ap); + else + __vfprintf_chk (f, flag, fmt, ap); /* Close the memory stream; this will finalize the data into a malloc'd buffer in BUF. */ @@ -315,6 +314,16 @@ vsyslog(pri, fmt, ap) if (buf != failbuf) free (buf); } +libc_hidden_def (__vsyslog_chk) + +void +vsyslog(pri, fmt, ap) + int pri; + register const char *fmt; + va_list ap; +{ + __vsyslog_chk (pri, -1, fmt, ap); +} libc_hidden_def (vsyslog) static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */ diff --git a/sysdeps/mach/hurd/mig-reply.c b/sysdeps/mach/hurd/mig-reply.c index 78bac4bffc..5e40c147b4 100644 --- a/sysdeps/mach/hurd/mig-reply.c +++ b/sysdeps/mach/hurd/mig-reply.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1994,1995,1996,1997,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ #define GETPORT \ mach_port_t *portloc = \ (mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY) -#define reply_port (use_threadvar ? *portloc : global_reply_port) +#define reply_port (*(use_threadvar ? portloc : &global_reply_port)) static int use_threadvar; static mach_port_t global_reply_port; diff --git a/sysdeps/powerpc/powerpc32/Makefile b/sysdeps/powerpc/powerpc32/Makefile index 82b4fc95f9..1d58a063d6 100644 --- a/sysdeps/powerpc/powerpc32/Makefile +++ b/sysdeps/powerpc/powerpc32/Makefile @@ -21,7 +21,7 @@ ifeq ($(subdir),csu) ifneq ($(elf),no) # The initfini generation code doesn't work in the presence of -fPIC, so # we use -fpic instead which is much better. -CFLAGS-initfini.s = -g0 -fpic -O1 +CFLAGS-initfini.s += -fpic -O1 # There is no benefit to using sdata for these objects, and the user # of the library should be able to control what goes into sdata. diff --git a/sysdeps/powerpc/powerpc64/Makefile b/sysdeps/powerpc/powerpc64/Makefile index 3ced6568df..cf29148ff3 100644 --- a/sysdeps/powerpc/powerpc64/Makefile +++ b/sysdeps/powerpc/powerpc64/Makefile @@ -12,9 +12,9 @@ endif ifeq ($(subdir),csu) ifneq ($(elf),no) -# The initfini generation code doesn't work in the presence of -g1 or -# higher, so we use -g0. -CFLAGS-initfini.s = -g0 -fpic -O1 +# The initfini generation code doesn't work in the presence of -fPIC, so +# we use -fpic instead which is much better. +CFLAGS-initfini.s += -fpic -O1 endif endif diff --git a/sysdeps/unix/sysv/linux/sigwait.c b/sysdeps/unix/sysv/linux/sigwait.c index 7c865963cd..279ca0203c 100644 --- a/sysdeps/unix/sysv/linux/sigwait.c +++ b/sysdeps/unix/sysv/linux/sigwait.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000,2002-2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -58,8 +58,11 @@ do_sigwait (const sigset_t *set, int *sig) real size of the user-level sigset_t. */ #ifdef INTERNAL_SYSCALL INTERNAL_SYSCALL_DECL (err); - ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set), - NULL, NULL, _NSIG / 8); + do + ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set), + NULL, NULL, _NSIG / 8); + while (INTERNAL_SYSCALL_ERROR_P (ret, err) + && INTERNAL_SYSCALL_ERRNO (ret, err) == EINTR); if (! INTERNAL_SYSCALL_ERROR_P (ret, err)) { *sig = ret; @@ -68,8 +71,10 @@ do_sigwait (const sigset_t *set, int *sig) else ret = INTERNAL_SYSCALL_ERRNO (ret, err); #else - ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), - NULL, NULL, _NSIG / 8); + do + ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), + NULL, NULL, _NSIG / 8); + while (ret == -1 && errno == EINTR); if (ret != -1) { *sig = ret; diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 335b38ab37..73e271775a 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -55,7 +55,7 @@ elf_machine_dynamic (void) static inline Elf64_Addr __attribute__ ((unused)) elf_machine_load_address (void) { - register Elf64_Addr addr, tmp; + Elf64_Addr addr; /* The easy way is just the same as on x86: leaq _dl_start, %0 @@ -66,15 +66,18 @@ elf_machine_load_address (void) Instead we store the address of _dl_start in the data section and compare it with the current value that we can get via - an RIP relative addressing mode. */ - - asm ("movq 1f(%%rip), %1\n" - "0:\tleaq _dl_start(%%rip), %0\n\t" - "subq %1, %0\n\t" - ".section\t.data\n" + an RIP relative addressing mode. Note that this is the address + of _dl_start before any relocation performed at runtime. In case + the binary is prelinked the resulting "address" is actually a + load offset which is zero if the binary was loaded at the address + it is prelinked for. */ + + asm ("leaq _dl_start(%%rip), %0\n\t" + "subq 1f(%%rip), %0\n\t" + ".section\t.data.rel.ro\n" "1:\t.quad _dl_start\n\t" ".previous\n\t" - : "=r" (addr), "=r" (tmp) : : "cc"); + : "=r" (addr) : : "cc"); return addr; } diff --git a/timezone/africa b/timezone/africa index 689c2c414c..7d75ae3a05 100644 --- a/timezone/africa +++ b/timezone/africa @@ -1,10 +1,10 @@ -# @(#)africa 7.37 +# @(#)africa 7.38 # This data is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to # tz@elsie.nci.nih.gov for general use in the future). -# From Paul Eggert <eggert@twinsun.com> (1999-03-22): +# From Paul Eggert (1999-03-22): # # A good source for time zone historical data outside the U.S. is # Thomas G. Shanks, The International Atlas (5th edition), @@ -28,7 +28,7 @@ # # Previous editions of this database used WAT, CAT, SAT, and EAT # for +0:00 through +3:00, respectively, -# but Mark R V Murray <markm@grondar.za> reports that +# but Mark R V Murray reports that # `SAST' is the official abbreviation for +2:00 in the country of South Africa, # `CAT' is commonly used for +2:00 in countries north of South Africa, and # `WAT' is probably the best name for +1:00, as the common phrase for @@ -287,7 +287,7 @@ Zone Africa/Maseru 1:50:00 - LMT 1903 Mar 2:00 - SAST # Liberia -# From Paul Eggert <eggert@twinsun.com> (2001-07-17): +# From Paul Eggert (2001-07-17): # In 1972 Liberia was the last country to switch # from a UTC offset that was not a multiple of 15 or 20 minutes. # Howse reports that it was in honor of their president's birthday. diff --git a/timezone/antarctica b/timezone/antarctica index ad47860bd6..c11d24e7d5 100644 --- a/timezone/antarctica +++ b/timezone/antarctica @@ -1,4 +1,4 @@ -# @(#)antarctica 7.24 +# @(#)antarctica 7.25 # From Paul Eggert (1999-11-15): # To keep things manageable, we list only locations occupied year-round; see @@ -157,7 +157,7 @@ Zone Antarctica/DumontDUrville 0 - zzz 1947 # From Hideyuki Suzuki (1999-02-06): # In all Japanese stations, +0300 is used as the standard time. [See] # <a href="http://www.crl.go.jp/uk/uk201/basyo.htm">[reference in Japanese]</a> -# and information from KAMO Hiroyasu <wd@ics.nara-wu.ac.jp>. +# and information from KAMO Hiroyasu. # # Syowa station, which is the first antarctic station of Japan, # was established on 1957-01-29. Since Syowa station is still the main @@ -271,7 +271,7 @@ Zone Antarctica/Rothera 0 - zzz 1976 Dec 1 # # Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) # -# From Ethan Dicks <erd@mcmsun5.mcmurdo.gov> (1996-10-06): +# From Ethan Dicks (1996-10-06): # It keeps the same time as Punta Arenas, Chile, because, just like us # and the South Pole, that's the other end of their supply line.... # I verified with someone who was there that since 1980, diff --git a/timezone/asia b/timezone/asia index 024cb37e57..1a40fb4c5f 100644 --- a/timezone/asia +++ b/timezone/asia @@ -1,10 +1,10 @@ -# @(#)asia 7.82 +# @(#)asia 7.83 # This data is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to # tz@elsie.nci.nih.gov for general use in the future). -# From Paul Eggert <eggert@twinsun.com> (1999-03-22): +# From Paul Eggert (1999-03-22): # # A good source for time zone historical data outside the U.S. is # Thomas G. Shanks, The International Atlas (5th edition), @@ -190,7 +190,7 @@ Zone Asia/Phnom_Penh 6:59:40 - LMT 1906 Jun 9 # CHINA 8 H AHEAD OF UTC ALL OF CHINA, INCL TAIWAN # CHINA 9 H AHEAD OF UTC APR 17 - SEP 10 -# From Paul Eggert <eggert@twinsun.com> (1995-12-19): +# From Paul Eggert (1995-12-19): # Shanks writes that China has had a single time zone since 1980 May 1, # observing summer DST from 1986 through 1991; this contradicts Devine's # note about Time magazine, though apparently _something_ happened in 1986. @@ -329,13 +329,13 @@ Zone Asia/Nicosia 2:13:28 - LMT 1921 Nov 14 Link Asia/Nicosia Europe/Nicosia # Georgia -# From Paul Eggert <eggert@twinsun.com> (1994-11-19): +# From Paul Eggert (1994-11-19): # Today's _Economist_ (p 60) reports that Georgia moved its clocks forward # an hour recently, due to a law proposed by Zurab Murvanidze, # an MP who went on a hunger strike for 11 days to force discussion about it! # We have no details, but we'll guess they didn't move the clocks back in fall. # -# From Mathew Englander <mathew@io.org>, quoting AP (1996-10-23 13:05-04): +# From Mathew Englander, quoting AP (1996-10-23 13:05-04): # Instead of putting back clocks at the end of October, Georgia # will stay on daylight savings time this winter to save energy, # President Eduard Shevardnadze decreed Wednesday. @@ -564,7 +564,7 @@ Zone Asia/Tehran 3:25:44 - LMT 1916 # Iraq # -# From Jonathan Lennox <lennox@cs.columbia.edu> (2000-06-12): +# From Jonathan Lennox (2000-06-12): # An article in this week's Economist ("Inside the Saddam-free zone", p. 50 in # the U.S. edition) on the Iraqi Kurds contains a paragraph: # "The three northern provinces ... switched their clocks this spring and @@ -663,7 +663,7 @@ Rule Zion 1987 only - Sep 13 0:00 0 S Rule Zion 1988 only - Apr 9 0:00 1:00 D Rule Zion 1988 only - Sep 3 0:00 0 S -# From Ephraim Silverberg <ephraim@cs.huji.ac.il> +# From Ephraim Silverberg # (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22, # and 2005-02-17): @@ -843,7 +843,7 @@ Zone Asia/Jerusalem 2:20:56 - LMT 1880 # `9:00' and `JST' is from Guy Harris. -# From Paul Eggert <eggert@twinsun.com> (1995-03-06): +# From Paul Eggert (1995-03-06): # Today's _Asahi Evening News_ (page 4) reports that Japan had # daylight saving between 1948 and 1951, but ``the system was discontinued # because the public believed it would lead to longer working hours.'' @@ -932,7 +932,7 @@ Zone Asia/Amman 2:23:44 - LMT 1931 # Kazakhstan # From Paul Eggert (1996-11-22): -# Andrew Evtichov <evti@chevron.com> (1996-04-13) writes that Kazakhstan +# Andrew Evtichov (1996-04-13) writes that Kazakhstan # stayed in sync with Moscow after 1990, and that Aqtobe (formerly Aktyubinsk) # and Aqtau (formerly Shevchenko) are the largest cities in their zones. # Guess that Aqtau and Aqtobe diverged in 1995, since that's the first time @@ -1182,7 +1182,7 @@ Zone Indian/Maldives 4:54:00 - LMT 1880 # Male # # [The province of Selenge is omitted from the above lists.] -# From Ganbold Ts., Ulaanbaatar <ganbold@micom.mng.net> (2004-04-17): +# From Ganbold Ts., Ulaanbaatar (2004-04-17): # Daylight saving occurs at 02:00 local time last Saturday of March. # It will change back to normal at 02:00 local time last Saturday of # September.... As I remember this rule was changed in 2001. @@ -1282,7 +1282,7 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # Palestine -# From Amos Shapir <amos@nsof.co.il> (1998-02-15): +# From Amos Shapir (1998-02-15): # # From 1917 until 1948-05-15, all of Palestine, including the parts now # known as the Gaza Strip and the West Bank, was under British rule. @@ -1544,7 +1544,7 @@ Zone Asia/Tashkent 4:37:12 - LMT 1924 May 2 5:00 - UZT # Vietnam -# From Paul Eggert <eggert@twinsun.com> (1993-11-18): +# From Paul Eggert (1993-11-18): # Saigon's official name is Thanh-Pho Ho Chi Minh, but it's too long. # We'll stick with the traditional name for now. # From Shanks: diff --git a/timezone/australasia b/timezone/australasia index 41c7368852..b39ada2cd4 100644 --- a/timezone/australasia +++ b/timezone/australasia @@ -1,4 +1,4 @@ -# @(#)australasia 7.71 +# @(#)australasia 7.72 # This file also includes Pacific islands. # Notes are at the end of this file @@ -38,7 +38,7 @@ Zone Australia/Perth 7:43:24 - LMT 1895 Dec 8:00 - WST # Queensland # -# From Alex Livingston <alex@agsm.unsw.edu.au> (1996-11-01): +# From Alex Livingston (1996-11-01): # I have heard or read more than once that some resort islands off the coast # of Queensland chose to keep observing daylight-saving time even after # Queensland ceased to. @@ -488,7 +488,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # go ahead and edit the file (and please send any changes to # tz@elsie.nci.nih.gov for general use in the future). -# From Paul Eggert <eggert@twinsun.com> (1999-10-29): +# From Paul Eggert (1999-10-29): # A good source for time zone historical data outside the U.S. is # Thomas G. Shanks, The International Atlas (5th edition), # San Diego: ACS Publications, Inc. (1999). @@ -645,13 +645,13 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # From Paul Eggert (1995-12-19): # Shanks reports 2:00 for all autumn changes in Australia and New Zealand. -# Mark Prior <mrp@itd.adelaide.edu.au> writes that his newspaper +# Mark Prior writes that his newspaper # reports that NSW's fall 1995 change will occur at 2:00, # but Robert Elz says it's been 3:00 in Victoria since 1970 # and perhaps the newspaper's `2:00' is referring to standard time. # For now we'll continue to assume 2:00s for changes since 1960. -# From Eric Ulevik <eau@zip.com.au> (1998-01-05): +# From Eric Ulevik (1998-01-05): # # Here are some URLs to Australian time legislation. These URLs are stable, # and should probably be included in the data file. There are probably more @@ -916,7 +916,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # From Arthur David Olson: # New South Wales and subjurisdictions have their own ideas of a fun time. -# Based on law library research by John Mackin (john@basser.cs.su.oz), +# Based on law library research by John Mackin, # who notes: # In Australia, time is not legislated federally, but rather by the # individual states. Thus, while such terms as ``Eastern Standard Time'' @@ -936,7 +936,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # Lawlink NSW: Daylight Saving in New South Wales # </a> -# From Eric Ulevik <eau@ozemail.com.au> (1999-05-26): +# From Eric Ulevik (1999-05-26): # DST will start in NSW on the last Sunday of August, rather than the usual # October in 2000. [See: Matthew Moore, # <a href="http://www.smh.com.au/news/9905/26/pageone/pageone4.html"> @@ -1070,7 +1070,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # From Paul Eggert (1995-12-19); # Shanks reports 2:00 for all autumn changes in Australia and New Zealand. -# Robert Uzgalis <buz@cs.aukuni.ac.nz> writes that the New Zealand Daylight +# Robert Uzgalis writes that the New Zealand Daylight # Savings Time Order in Council dated 1990-06-18 specifies 2:00 standard # time on both the first Sunday in October and the third Sunday in March. # As with Australia, we'll assume the tradition is 2:00s, not 2:00. @@ -1149,7 +1149,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # Micronesia -# Alan Eugene Davis <adavis@kuentos.guam.net> writes (1996-03-16), +# Alan Eugene Davis writes (1996-03-16), # ``I am certain, having lived there for the past decade, that "Truk" # (now properly known as Chuuk) ... is in the time zone GMT+10.'' # @@ -1257,10 +1257,10 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # October to March, which has won approval in principle from the Tongan # Government. -# From Steffen Thorsen [straen@thorsen.priv.no] (1999-09-09): +# From Steffen Thorsen (1999-09-09): # * Tonga will introduce DST in November # -# I was given this link by John Letts <johnletts@earthlink.net>: +# I was given this link by John Letts: # <a hef="http://news.bbc.co.uk/hi/english/world/asia-pacific/newsid_424000/424764.stm"> # http://news.bbc.co.uk/hi/english/world/asia-pacific/newsid_424000/424764.stm # </a> @@ -1270,7 +1270,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # of UTC as well, but as far as I know Fiji will only be 13 hours ahead # (12 + 1 hour DST). -# From Arthur David Olson [arthur_david_olson@nih.gov] (1999-09-20): +# From Arthur David Olson (1999-09-20): # According to <a href="http://www.tongaonline.com/news/sept1799.html> # http://www.tongaonline.com/news/sept1799.html # </a>: diff --git a/timezone/checktab.awk b/timezone/checktab.awk index 6a2d19ae00..6d532141e6 100644 --- a/timezone/checktab.awk +++ b/timezone/checktab.awk @@ -1,8 +1,8 @@ # Check tz tables for consistency. -# @(#)checktab.awk 1.6 +# @(#)checktab.awk 1.7 -# Contributed by Paul Eggert <eggert@twinsun.com>. +# Contributed by Paul Eggert. BEGIN { FS = "\t" diff --git a/timezone/europe b/timezone/europe index 3bf1b1ab02..9535a667b5 100644 --- a/timezone/europe +++ b/timezone/europe @@ -1,10 +1,10 @@ -# @(#)europe 7.92 +# @(#)europe 7.94 # This data is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to # tz@elsie.nci.nih.gov for general use in the future). -# From Paul Eggert <eggert@twinsun.com> (1999-10-29): +# From Paul Eggert (1999-10-29): # A good source for time zone historical data outside the U.S. is # Thomas G. Shanks, The International Atlas (5th edition), # San Diego: ACS Publications, Inc. (1999). @@ -55,7 +55,7 @@ # A reliable and entertaining source about time zones, especially in Britain, # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). -# From Peter Ilieve <peter@memex.co.uk> (1994-12-04), +# From Peter Ilieve (1994-12-04), # The original six [EU members]: Belgium, France, (West) Germany, Italy, # Luxembourg, the Netherlands. # Plus, from 1 Jan 73: Denmark, Ireland, United Kingdom. @@ -81,7 +81,7 @@ # Britain (United Kingdom) and Ireland (Eire) -# From Peter Ilieve <peter@memex.co.uk> (1994-07-06): +# From Peter Ilieve (1994-07-06): # # On 17 Jan 1994 the Independent, a UK quality newspaper, had a piece about # historical vistas along the Thames in west London. There was a photo @@ -102,7 +102,7 @@ # # [This yields GMTOFF = -0:01:15 for London LMT in the 18th century.] -# From Paul Eggert <eggert@twinsun.com> (1993-11-18): +# From Paul Eggert (1993-11-18): # # Howse writes that Britain was the first country to use standard time. # The railways cared most about the inconsistencies of local mean time, @@ -168,12 +168,12 @@ # known as "British" Summer Time in all parts of the United Kingdom. # Date: 4 Jan 89 08:57:25 GMT (Wed) -# From: Jonathan Leffler <nih-csl!uunet!mcvax!sphinx.co.uk!john> +# From: Jonathan Leffler # [British Summer Time] is fixed annually by Act of Parliament. # If you can predict what Parliament will do, you should be in # politics making a fortune, not computing. -# From Chris Carrier <72157.3334@CompuServe.COM> (1996-06-14): +# From Chris Carrier (1996-06-14): # I remember reading in various wartime issues of the London Times the # acronym BDST for British Double Summer Time. Look for the published # time of sunrise and sunset in The Times, when BDST was in effect, and @@ -204,15 +204,15 @@ # and follows the more usual convention of putting the location name first, # so we use `BDST'. -# Peter Ilieve <peter@aldie.co.uk> (1998-04-19) described at length +# Peter Ilieve (1998-04-19) described at length # the history of summer time legislation in the United Kingdom. -# Since 1998 Joseph S. Myers <jsm28@cam.ac.uk> has been updating +# Since 1998 Joseph S. Myers has been updating # and extending this list, which can be found in # <a href="http://student.cusu.cam.ac.uk/~jsm28/british-time/"> # History of legal time in Britain # </a> -# From Joseph S. Myers <jsm28@cam.ac.uk> (1998-01-06): +# From Joseph S. Myers (1998-01-06): # # The legal time in the UK outside of summer time is definitely GMT, not UTC; # see Lord Tanlaw's speech @@ -536,7 +536,7 @@ Zone EET 2:00 EU EE%sT # Previous editions of this database used abbreviations like MET DST # for Central European Summer Time, but this didn't agree with common usage. -# From Markus Kuhn <mskuhn@unrza3.dialin.rrze.uni-erlangen.de> (1996-07-12): +# From Markus Kuhn (1996-07-12): # The official German names ... are # # Mitteleuropaeische Zeit (MEZ) = UTC+01:00 @@ -652,7 +652,7 @@ Zone Europe/Minsk 1:50:16 - LMT 1880 # pp 8-9. # LMT before 1892 was 0:17:30, according to the official journal of Belgium: # Moniteur Belge, Samedi 30 Avril 1892, N.121. -# Thanks to Pascal Delmoitie <pascal@belnet.be> for these references. +# Thanks to Pascal Delmoitie for these references. # The 1918 rules are listed for completeness; they apply to unoccupied Belgium. # Assume Brussels switched to WET in 1918 when the armistice took effect. # @@ -711,7 +711,7 @@ Zone Europe/Brussels 0:17:30 - LMT 1880 # Bulgaria # -# From Plamen Simenov <P.Simeonov@cnsys.bg> via Steffen Thorsen (1999-09-09): +# From Plamen Simenov via Steffen Thorsen (1999-09-09): # A document of Government of Bulgaria (No.94/1997) says: # EET --> EETDST is in 03:00 Local time in last Sunday of March ... # EETDST --> EET is in 04:00 Local time in last Sunday of October @@ -874,12 +874,12 @@ Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik air base -4:00 Thule A%sT # Estonia -# From Peter Ilieve <peter@memex.co.uk> (1994-10-15): +# From Peter Ilieve (1994-10-15): # A relative in Tallinn confirms the accuracy of the data for 1989 onwards # [through 1994] and gives the legal authority for it, # a regulation of the Government of Estonia, No. 111 of 1989.... # -# From Peter Ilieve <peter@aldie.co.uk> (1996-10-28): +# From Peter Ilieve (1996-10-28): # [IATA SSIM (1992/1996) claims that the Baltic republics switch at 01:00s, # but a relative confirms that Estonia still switches at 02:00s, writing:] # ``I do not [know] exactly but there are some little different @@ -889,7 +889,7 @@ Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik air base # human physiology. It seems that Estonia maybe will not change to # summer time next spring.'' -# From Peter Ilieve <peter@aldie.co.uk> (1998-11-04), heavily edited: +# From Peter Ilieve (1998-11-04), heavily edited: # <a href="http://trip.rk.ee/cgi-bin/thw?${BASE}=akt&${OOHTML}=rtd&TA=1998&TO=1&AN=1390"> # The 1998-09-22 Estonian time law # </a> @@ -938,11 +938,11 @@ Zone Europe/Tallinn 1:39:00 - LMT 1880 # Finland # -# From Hannu Strang <chs@apu.fi> (25 Sep 1994 06:03:37 UTC): +# From Hannu Strang (25 Sep 1994 06:03:37 UTC): # Well, here in Helsinki we're just changing from summer time to regular one, # and it's supposed to change at 4am... # -# From Paul Eggert <eggert@twinsun.com> (25 Sep 1994): +# From Paul Eggert (25 Sep 1994): # Shanks says Finland has switched at 02:00 standard time since 1981. # Go with Strang instead. # @@ -1019,7 +1019,7 @@ Rule France 1940 only - Feb 25 2:00 1:00 S # Dole, Morez, St-Claude, and Collognes (Haute-Savioe). Rule France 1941 only - May 5 0:00 2:00 M # Midsummer # Shanks says this transition occurred at Oct 6 1:00, -# but go with Denis.Excoffier@ens.fr (1997-12-12), +# but go with Denis Excoffier (1997-12-12), # who quotes the Ephemerides Astronomiques for 1998 from Bureau des Longitudes # as saying 5/10/41 22hUT. Rule France 1941 only - Oct 6 0:00 1:00 S @@ -1053,7 +1053,7 @@ Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01 # Germany -# From Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> (1998-09-29): +# From Markus Kuhn (1998-09-29): # The German time zone web site by the Physikalisch-Technische # Bundesanstalt contains DST information back to 1916. # [See tz-link.htm for the URL.] @@ -1168,7 +1168,7 @@ Zone Europe/Budapest 1:16:20 - LMT 1890 Oct # Iceland # -# From Adam David <adam@veda.is> (1993-11-06): +# From Adam David (1993-11-06): # The name of the timezone in Iceland for system / mail / news purposes is GMT. # # (1993-12-05): @@ -1195,7 +1195,7 @@ Zone Europe/Budapest 1:16:20 - LMT 1890 Oct # might be a reference to the Julian calendar as opposed to Gregorian, or it # might mean something else (???). # -# From Paul Eggert <eggert@twinsun.com> (1999-10-29): +# From Paul Eggert (1999-10-29): # The Iceland Almanak, Shanks and Whitman disagree on many points. # We go with the Almanak, except for one claim from Shanks, namely that # Reykavik was 21W57 from 1837 to 1908, local mean time before that. @@ -1311,7 +1311,7 @@ Link Europe/Rome Europe/San_Marino # Latvia -# From Liene Kanepe <Liene_Kanepe@lm.gov.lv> (1998-09-17): +# From Liene Kanepe (1998-09-17): # I asked about this matter Scientific Secretary of the Institute of Astronomy # of The University of Latvia Dr. paed Mr. Ilgonis Vilks. I also searched the @@ -1398,7 +1398,7 @@ Zone Europe/Vaduz 0:38:04 - LMT 1894 Jun # IATA SSIM (1992/1996) says Lithuania uses W-Eur rules, but since it is # known to be wrong about Estonia and Latvia, assume it's wrong here too. -# From Marius Gedminas <mgedmin@pub.osf.lt> (1998-08-07): +# From Marius Gedminas (1998-08-07): # I would like to inform that in this year Lithuanian time zone # (Europe/Vilnius) was changed. @@ -1505,7 +1505,7 @@ Zone Europe/Malta 0:58:04 - LMT 1893 Nov 2 # Valletta # on 1991-08-27 (the 1992-01-19 date is that of a Russian decree). # In early 1992 there was large-scale interethnic violence in the area # and it's possible that some Russophones continued to observe Moscow time. -# But moldavizolit@tirastel.md and mk@tirastel.md separately reported via +# But [two people] separately reported via # Jesper Norgaard that as of 2001-01-24 Tiraspol was like Chisinau. # The Tiraspol entry has therefore been removed for now. @@ -1716,7 +1716,7 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 # says the autumn 1995 switch was at 02:00. # Stick with W-Eur for now. # -# From Marcin.Kasperski@softax.com.pl (1999-06-10): +# From Marcin Kasperski (1999-06-10): # According to my colleagues someone recently decided, that Poland would # follow European Union regulations, so - I think - the matter is not # worth further discussion. @@ -1729,11 +1729,11 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 # Portugal # -# From Rui Pedro Salgueiro <rps@inescca.inescc.pt> (1992-11-12): +# From Rui Pedro Salgueiro (1992-11-12): # Portugal has recently (September, 27) changed timezone # (from WET to MET or CET) to harmonize with EEC. # -# Martin Bruckmann <martin@ua.pt> (1996-02-29) reports via Peter Ilieve +# Martin Bruckmann (1996-02-29) reports via Peter Ilieve # that Portugal is reverting to 0:00 by not moving its clocks this spring. # The new Prime Minister was fed up with getting up in the dark in the winter. # @@ -1863,25 +1863,25 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Russia -# From Paul Eggert <eggert@twinsun.com> (1999-11-12): +# From Paul Eggert (1999-11-12): # Except for Moscow after 1919-07-01, I invented the time zone abbreviations. # Moscow time zone abbreviations after 1919-07-01, and Moscow rules after 1991, # are from Andrey A. Chernov. The rest is from Shanks, except we follow # Chernov's report that 1992 DST transitions were Sat 23:00, not Sun 02:00s. # -# From Stanislaw A. Kuzikowski <S.A.Kuz@iae.nsk.su> (1994-06-29): +# From Stanislaw A. Kuzikowski (1994-06-29): # But now it is some months since Novosibirsk is 3 hours ahead of Moscow! # I do not know why they have decided to make this change; # as far as I remember it was done exactly during winter->summer switching # so we (Novosibirsk) simply did not switch. # -# From Andrey A. Chernov <ache@nagual.ru> (1996-10-04): +# From Andrey A. Chernov (1996-10-04): # `MSK' and `MSD' were born and used initially on Moscow computers with # UNIX-like OSes by several developer groups (e.g. Demos group, Kiae group).... # The next step was the UUCP network, the Relcom predecessor # (used mainly for mail), and MSK/MSD was actively used there. # -# From Chris Carrier <72157.3334@CompuServe.COM> (1996-10-30): +# From Chris Carrier (1996-10-30): # According to a friend of mine who rode the Trans-Siberian Railroad from # Moscow to Irkutsk in 1995, public air and rail transport in Russia ... # still follows Moscow time, no matter where in Russia it is located. @@ -2069,7 +2069,7 @@ Zone Europe/Belgrade 1:22:00 - LMT 1884 1:00 - CET 1941 Apr 18 23:00 1:00 C-Eur CE%sT 1945 May 8 2:00s 1:00 1:00 CEST 1945 Sep 16 2:00s -# Metod Kozelj <metod.kozelj@rzs-hm.si> reports that the legal date of +# Metod Kozelj reports that the legal date of # transition to EU rules was 1982-11-27, for all of Yugoslavia at the time. # Shanks doesn't give as much detail, so go with Kozelj. 1:00 - CET 1982 Nov 27 @@ -2343,7 +2343,7 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880 3:00 Russia MSK/MSD 1990 3:00 - MSK 1990 Jul 1 2:00 2:00 - EET 1992 -# From Paul Eggert <eggert@twinsun.com> (1999-11-12): +# From Paul Eggert (1999-11-12): # The _Economist_ (1994-05-28, p 45) reports that central Crimea switched # from Kiev to Moscow time sometime after the January 1994 elections. # Shanks says ``date of change uncertain'', but implies that it happened @@ -2373,8 +2373,7 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880 # ... # Date: Wed, 28 Jan 87 16:56:27 -0100 -# From: seismo!mcvax!cgcha!wtho (Tom Hofmann) -# Message-Id: <8701281556.AA22174@cgcha.uucp> +# From: Tom Hofmann # ... # # ...the European time rules are...standardized since 1981, when @@ -2393,11 +2392,11 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880 # # Tom Hofmann, Scientific Computer Center, CIBA-GEIGY AG, # 4002 Basle, Switzerland -# UUCP: ...!mcvax!cernvax!cgcha!wtho +# ... # ... # Date: Wed, 4 Feb 87 22:35:22 +0100 -# From: seismo!mcvax!cwi.nl!dik (Dik T. Winter) +# From: Dik T. Winter # ... # # The information from Tom Hofmann is (as far as I know) not entirely correct. @@ -2423,8 +2422,7 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880 # # ... # dik t. winter, cwi, amsterdam, nederland -# INTERNET : dik@cwi.nl -# BITNET/EARN: dik@mcvax +# ... # From Bob Devine (1988-01-28): # ... diff --git a/timezone/iso3166.tab b/timezone/iso3166.tab index dad0d9d34a..07b43fc7c4 100644 --- a/timezone/iso3166.tab +++ b/timezone/iso3166.tab @@ -1,8 +1,8 @@ # ISO 3166 alpha-2 country codes # -# @(#)iso3166.tab 1.16 +# @(#)iso3166.tab 1.17 # -# From Paul Eggert <eggert@twinsun.com> (2004-06-14): +# From Paul Eggert (2004-06-14): # # This file contains a table with the following columns: # 1. ISO 3166-1 alpha-2 country code, current as of diff --git a/timezone/leapseconds b/timezone/leapseconds index 2966e760e3..a1078837d7 100644 --- a/timezone/leapseconds +++ b/timezone/leapseconds @@ -1,4 +1,4 @@ -# @(#)leapseconds 7.19 +# @(#)leapseconds 7.20 # Allowance for leapseconds added to each timezone file. @@ -43,8 +43,10 @@ Leap 1994 Jun 30 23:59:60 + S Leap 1995 Dec 31 23:59:60 + S Leap 1997 Jun 30 23:59:60 + S Leap 1998 Dec 31 23:59:60 + S +Leap 2005 Dec 31 23:59:60 + S # INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS) +# # SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE # # SERVICE DE LA ROTATION TERRESTRE @@ -52,29 +54,39 @@ Leap 1998 Dec 31 23:59:60 + S # 61, Av. de l'Observatoire 75014 PARIS (France) # Tel. : 33 (0) 1 40 51 22 26 # FAX : 33 (0) 1 40 51 22 91 -# Internet : services.iers@obspm.fr -# -# Paris, 21 July 2004 -# +# ... +# http://hpiers.obspm.fr/eop-pc # -# Bulletin C 28 +# Paris, 4 July 2005 +# +# Bulletin C 30 # # To authorities responsible # for the measurement and # distribution of time # -# INFORMATION ON UTC - TAI # -# NO positive leap second will be introduced at the end of December 2004. +# UTC TIME STEP +# on the 1st of January 2006 +# +# A positive leap second will be introduced at the end of December 2005. +# The sequence of dates of the UTC second markers will be: +# +# 2005 December 31, 23h 59m 59s +# 2005 December 31, 23h 59m 60s +# 2006 January 1, 0h 0m 0s +# # The difference between UTC and the International Atomic Time TAI is: # -# from 1999 January 1, 0h UTC, until further notice : UTC-TAI = -32 s +# from 1999 January 1, 0h UTC, to 2006 January 1 0h UTC : UTC-TAI = - 32s +# from 2006 January 1, 0h UTC, until further notice : UTC-TAI = - 33s # -# Leap seconds can be introduced in UTC at the end of the months of December +# Leap seconds can be introduced in UtC at the end of the months of December # or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every -# six months, either to announce a time step in UTC, or to confirm that there +# six months, either to announce a time step in UTC or to confirm that there # will be no time step at the next possible date. # # Daniel GAMBIS -# Director +# Head # Earth Orientation Center of IERS +# Observatoire de Paris, France diff --git a/timezone/northamerica b/timezone/northamerica index 64e4409345..c290caf67b 100644 --- a/timezone/northamerica +++ b/timezone/northamerica @@ -1,4 +1,4 @@ -# @(#)northamerica 7.74 +# @(#)northamerica 7.75 # also includes Central America and the Caribbean # This data is by no means authoritative; if you think you know better, @@ -83,7 +83,7 @@ # Time' instead of the old familiar 'Eastern War Time.' Peace is wonderful." # </a> (August 1945) by way of confirmation. -# From Joseph Gallant <notquite@hotmail.com>, citing +# From Joseph Gallant citing # George H. Douglas, _The Early Days of Radio Broadcasting_ (1987): # At 7 P.M. (Eastern War Time) [on 1945-08-14], the networks were set # to switch to London for Attlee's address, but the American people @@ -737,7 +737,7 @@ Link Pacific/Honolulu HST # Canada -# From Alain LaBont<e'> <ALB@immedia.ca> (1994-11-14): +# From Alain LaBont<e'> (1994-11-14): # I post here the time zone abbreviations standardized in Canada # for both English and French in the CAN/CSA-Z234.4-89 standard.... # @@ -1151,7 +1151,7 @@ Zone America/Winnipeg -6:28:36 - LMT 1887 Jul 16 # Matthews and Vincent (1998) write that Denare Beach and Creighton # are like Winnipeg, in violation of Saskatchewan law. -# From W. Jones <jones@skdad.usask.ca> (1992-11-06): +# From W. Jones (1992-11-06): # The. . .below is based on information I got from our law library, the # provincial archives, and the provincial Community Services department. # A precise history would require digging through newspaper archives, and @@ -1269,7 +1269,7 @@ Zone America/Dawson_Creek -8:00:56 - LMT 1884 # From Paul Eggert (1999-10-29): # Dawson switched to PST in 1973. Inuvik switched to MST in 1979. -# Mathew Englander <mathew@io.org> (1996-10-07) gives the following refs: +# Mathew Englander (1996-10-07) gives the following refs: # * 1967. Paragraph 28(34)(g) of the Interpretation Act, S.C. 1967-68, # c. 7 defines Yukon standard time as UTC-9. This is still valid; # see Interpretation Act, R.S.C. 1985, c. I-21, s. 35(1). @@ -1448,7 +1448,7 @@ Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 # Shanks gives 1942-04-01 instead of 1942-04-24, and omits the 1981 # and 1988 DST experiments. Go with spin.com.mx. -# From Alan Perry <alan.perry@eng.sun.com> (1996-02-15): +# From Alan Perry (1996-02-15): # A guy from our Mexico subsidiary finally found the Presidential Decree # outlining the timezone changes in Mexico. # diff --git a/timezone/private.h b/timezone/private.h index 5de2f7dfe4..9a1ef22abb 100644 --- a/timezone/private.h +++ b/timezone/private.h @@ -25,6 +25,8 @@ static char privatehid[] = "@(#)private.h 7.55"; #endif /* !defined NOID */ #endif /* !defined lint */ +#define GRANDPARENTED "Local time zone must be set--see zic manual page" + /* ** Defaults for preprocessor symbols. ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'. @@ -91,13 +93,13 @@ static char privatehid[] = "@(#)private.h 7.55"; #include "time.h" #include "stdlib.h" -#if HAVE_GETTEXT - 0 +#if HAVE_GETTEXT #include "libintl.h" -#endif /* HAVE_GETTEXT - 0 */ +#endif /* HAVE_GETTEXT */ -#if HAVE_SYS_WAIT_H - 0 +#if HAVE_SYS_WAIT_H #include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */ -#endif /* HAVE_SYS_WAIT_H - 0 */ +#endif /* HAVE_SYS_WAIT_H */ #ifndef WIFEXITED #define WIFEXITED(status) (((status) & 0xff) == 0) @@ -106,20 +108,20 @@ static char privatehid[] = "@(#)private.h 7.55"; #define WEXITSTATUS(status) (((status) >> 8) & 0xff) #endif /* !defined WEXITSTATUS */ -#if HAVE_UNISTD_H - 0 +#if HAVE_UNISTD_H #include "unistd.h" /* for F_OK and R_OK */ -#endif /* HAVE_UNISTD_H - 0 */ +#endif /* HAVE_UNISTD_H */ -#if !(HAVE_UNISTD_H - 0) +#if !HAVE_UNISTD_H #ifndef F_OK #define F_OK 0 #endif /* !defined F_OK */ #ifndef R_OK #define R_OK 4 #endif /* !defined R_OK */ -#endif /* !(HAVE_UNISTD_H - 0) */ +#endif /* !HAVE_UNISTD_H */ -/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ +/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ #define is_digit(c) ((unsigned)(c) - '0' <= 9) /* @@ -216,7 +218,7 @@ char * imalloc P((int n)); void * irealloc P((void * pointer, int size)); void icfree P((char * pointer)); void ifree P((char * pointer)); -char * scheck P((const char *string, const char *format)); +char * scheck P((const char *string, char *format)); /* ** Finally, some convenience items. @@ -255,7 +257,8 @@ char * scheck P((const char *string, const char *format)); ** add one more for a minus sign if the type is signed. */ #define INT_STRLEN_MAXIMUM(type) \ - ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type)) + ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \ + 1 + TYPE_SIGNED(type)) #endif /* !defined INT_STRLEN_MAXIMUM */ /* @@ -289,11 +292,11 @@ char * scheck P((const char *string, const char *format)); */ #ifndef _ -#if HAVE_GETTEXT - 0 +#if HAVE_GETTEXT #define _(msgid) gettext(msgid) -#else /* !(HAVE_GETTEXT - 0) */ +#else /* !HAVE_GETTEXT */ #define _(msgid) msgid -#endif /* !(HAVE_GETTEXT - 0) */ +#endif /* !HAVE_GETTEXT */ #endif /* !defined _ */ #ifndef TZ_DOMAIN diff --git a/timezone/scheck.c b/timezone/scheck.c index fd115f9c48..2dd9b35285 100644 --- a/timezone/scheck.c +++ b/timezone/scheck.c @@ -11,7 +11,7 @@ static char elsieid[] = "@(#)scheck.c 8.16"; char * scheck(string, format) const char * const string; -const char * const format; +char * const format; { register char * fbuf; register const char * fp; diff --git a/timezone/solar87 b/timezone/solar87 index 3f32347973..21ba2c2d64 100644 --- a/timezone/solar87 +++ b/timezone/solar87 @@ -1,4 +1,4 @@ -# @(#)solar87 7.3 +# @(#)solar87 7.4 # So much for footnotes about Saudi Arabia. # Apparent noon times below are for Riyadh; your mileage will vary. @@ -381,8 +381,8 @@ Rule sol87 1987 only - Dec 31 12:02:45s -0:02:45 - # Before and after 1987, we'll operate on local mean solar time. # Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] -Zone Asia/Riyadh87 3:07:04 - ?? 1987 - 3:07:04 sol87 ?? 1988 - 3:07:04 - ?? +Zone Asia/Riyadh87 3:07:04 - zzz 1987 + 3:07:04 sol87 zzz 1988 + 3:07:04 - zzz # For backward compatibility... Link Asia/Riyadh87 Mideast/Riyadh87 diff --git a/timezone/solar88 b/timezone/solar88 index 41a64e5023..7e15f2b077 100644 --- a/timezone/solar88 +++ b/timezone/solar88 @@ -1,4 +1,4 @@ -# @(#)solar88 7.3 +# @(#)solar88 7.4 # Apparent noon times below are for Riyadh; they're a bit off for other places. # Times were computed using formulas in the U.S. Naval Observatory's @@ -381,8 +381,8 @@ Rule sol88 1988 only - Dec 31 12:03:05s -0:03:05 - # Before and after 1988, we'll operate on local mean solar time. # Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] -Zone Asia/Riyadh88 3:07:04 - ?? 1988 - 3:07:04 sol88 ?? 1989 - 3:07:04 - ?? +Zone Asia/Riyadh88 3:07:04 - zzz 1988 + 3:07:04 sol88 zzz 1989 + 3:07:04 - zzz # For backward compatibility... Link Asia/Riyadh88 Mideast/Riyadh88 diff --git a/timezone/solar89 b/timezone/solar89 index a6d3d718d3..3c36b6a30d 100644 --- a/timezone/solar89 +++ b/timezone/solar89 @@ -1,4 +1,4 @@ -# @(#)solar89 7.4 +# @(#)solar89 7.5 # Apparent noon times below are for Riyadh; they're a bit off for other places. # Times were computed using a formula provided by the U. S. Naval Observatory: @@ -386,8 +386,8 @@ Rule sol89 1989 only - Dec 31 12:03:00s -0:03:00 - # Before and after 1989, we'll operate on local mean solar time. # Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] -Zone Asia/Riyadh89 3:07:04 - ?? 1989 - 3:07:04 sol89 ?? 1990 - 3:07:04 - ?? +Zone Asia/Riyadh89 3:07:04 - zzz 1989 + 3:07:04 sol89 zzz 1990 + 3:07:04 - zzz # For backward compatibility... Link Asia/Riyadh89 Mideast/Riyadh89 diff --git a/timezone/southamerica b/timezone/southamerica index 6f3b081294..d348d7a475 100644 --- a/timezone/southamerica +++ b/timezone/southamerica @@ -1,10 +1,10 @@ -# @(#)southamerica 7.59 +# @(#)southamerica 7.60 # This data is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to # tz@elsie.nci.nih.gov for general use in the future). -# From Paul Eggert <eggert@twinsun.com> (1999-07-07): +# From Paul Eggert (1999-07-07): # A good source for time zone historical data outside the U.S. is # Thomas G. Shanks, The International Atlas (5th edition), # San Diego: ACS Publications, Inc. (1999). @@ -58,7 +58,7 @@ # From U. S. Naval Observatory (1988-01-199): # ARGENTINA 3 H BEHIND UTC -# From Hernan G. Otero <hernan@isoft.com.ar> (1995-06-26): +# From Hernan G. Otero (1995-06-26): # I am sending modifications to the Argentine time zone table... # AR was chosen because they are the ISO letters that represent Argentina. @@ -86,7 +86,7 @@ Rule Arg 1974 only - Jan 23 0:00 1:00 S Rule Arg 1974 only - May 1 0:00 0 - Rule Arg 1988 only - Dec 1 0:00 1:00 S # -# From Hernan G. Otero <hernan@isoft.com.ar> (1995-06-26): +# From Hernan G. Otero (1995-06-26): # These corrections were contributed by InterSoft Argentina S.A., # obtaining the data from the: # Talleres de Hidrografia Naval Argentina @@ -96,7 +96,7 @@ Rule Arg 1988 only - Dec 1 0:00 1:00 S Rule Arg 1989 1993 - Mar Sun>=1 0:00 0 - Rule Arg 1989 1992 - Oct Sun>=15 0:00 1:00 S # -# From Hernan G. Otero <hernan@isoft.com.ar> (1995-06-26): +# From Hernan G. Otero (1995-06-26): # From this moment on, the law that mandated the daylight saving # time corrections was derogated and no more modifications # to the time zones (for daylight saving) are now made. @@ -113,7 +113,7 @@ Rule Arg 2000 only - Mar Sun>=1 0:00 0 - # Argentina decided not to become one of the countries that go on or off DST. # So Buenos Aires should be -3 hours from GMT at all times. # -# From Fabian L. Arce Jofre <farcejofre@bigfoot.com> (2000-04-04): +# From Fabian L. Arce Jofre (2000-04-04): # The law that claimed DST for Argentina was derogated by President Fernando # de la Rua on March 2, 2000, because it would make people spend more energy # in the winter time, rather than less. The change took effect on March 3. @@ -374,7 +374,7 @@ Zone America/La_Paz -4:32:36 - LMT 1890 # Brazil -# From Paul Eggert <eggert@twinsun.com> (1993-11-18): +# From Paul Eggert (1993-11-18): # The mayor of Rio recently attempted to change the time zone rules # just in his city, in order to leave more summer time for the tourist trade. # The rule change lasted only part of the day; @@ -532,7 +532,7 @@ Rule Brazil 1996 only - Feb 11 0:00 0 - # adopted by same states, minus AL, SE. Rule Brazil 1996 only - Oct 6 0:00 1:00 S Rule Brazil 1997 only - Feb 16 0:00 0 - -# From Daniel C. Sobral <dcs@gns.com.br> (1998-02-12): +# From Daniel C. Sobral (1998-02-12): # In 1997, the DS began on October 6. The stated reason was that # because international television networks ignored Brazil's policy on DS, # they bought the wrong times on satellite for coverage of Pope's visit. @@ -1010,7 +1010,7 @@ Zone America/Port_of_Spain -4:06:04 - LMT 1912 Mar 2 -4:00 - AST # Uruguay -# From Paul Eggert <eggert@twinsun.com> (1993-11-18): +# From Paul Eggert (1993-11-18): # Uruguay wins the prize for the strangest peacetime manipulation of the rules. # From Shanks: # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh index be589240d1..f6e28bfdab 100644 --- a/timezone/tzselect.ksh +++ b/timezone/tzselect.ksh @@ -1,11 +1,11 @@ #! @KSH@ -# '@(#)tzselect.ksh 1.7' +# '@(#)tzselect.ksh 1.8' # Ask the user about the time zone, and output the resulting TZ value to stdout. # Interact with the user via stderr and stdin. -# Contributed by Paul Eggert <eggert@twinsun.com>. +# Contributed by Paul Eggert. # Porting notes: # diff --git a/timezone/zdump.c b/timezone/zdump.c index 2fcce38c06..78cc28ef65 100644 --- a/timezone/zdump.c +++ b/timezone/zdump.c @@ -1,4 +1,4 @@ -static char elsieid[] = "@(#)zdump.c 7.64"; +static char elsieid[] = "@(#)zdump.c 7.65"; /* ** This code has been made independent of the rest of the time @@ -144,8 +144,10 @@ static time_t absolute_min_time; static time_t absolute_max_time; static size_t longest; static char * progname; +static int warned; static char * abbr P((struct tm * tmp)); +static void abbrok P((const char * abbr, const char * zone)); static long delta P((struct tm * newp, struct tm * oldp)); static void dumptime P((const struct tm * tmp)); static time_t hunt P((char * name, time_t lot, time_t hit)); @@ -191,6 +193,44 @@ time_t * tp; } #endif /* !defined TYPECHECK */ +static void +abbrok(abbr, zone) +const char * const abbr; +const char * const zone; +{ + register int i; + register const char * cp; + register char * wp; + + if (warned) + return; + cp = abbr; + wp = NULL; + while (isascii(*cp) && isalpha(*cp)) + ++cp; + if (cp - abbr == 0) + wp = _("lacks alphabetic at start"); + if (cp - abbr < 3) + wp = _("has fewer than 3 alphabetics"); + if (cp - abbr > 6) + wp = _("has more than 6 alphabetics"); + if (wp == NULL && (*cp == '+' || *cp == '-')) { + ++cp; + if (isascii(*cp) && isdigit(*cp)) + if (*cp++ == '1' && *cp >= '0' && *cp <= '4') + ++cp; + } + if (*cp != '\0') + wp = _("differs from POSIX standard"); + if (wp == NULL) + return; + (void) fflush(stdout); + (void) fprintf(stderr, + "%s: warning: zone \"%s\" abbreviation \"%s\" %s\n", + progname, zone, abbr, wp); + warned = TRUE; +} + int main(argc, argv) int argc; @@ -216,7 +256,7 @@ char * argv[]; INITIALIZE(cutlotime); INITIALIZE(cuthitime); #if HAVE_GETTEXT - (void) setlocale(LC_MESSAGES, ""); + (void) setlocale(LC_ALL, ""); #ifdef TZ_DOMAINDIR (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); #endif /* defined TEXTDOMAINDIR */ @@ -297,6 +337,7 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"), show(argv[i], now, FALSE); continue; } + warned = FALSE; t = absolute_min_time; show(argv[i], t, TRUE); t += SECSPERHOUR * HOURSPERDAY; @@ -527,6 +568,8 @@ int v; } } (void) printf("\n"); + if (tmp != NULL && *abbr(tmp) != '\0') + abbrok(abbr(tmp), zone); } static char * diff --git a/timezone/zic.c b/timezone/zic.c index fb86fc69d2..57dc5311d5 100644 --- a/timezone/zic.c +++ b/timezone/zic.c @@ -1,4 +1,4 @@ -static char elsieid[] = "@(#)zic.c 7.122"; +static char elsieid[] = "@(#)zic.c 7.124"; /* ** Regardless of the type of time_t, we do our work using this type. @@ -10,6 +10,10 @@ typedef int zic_t; #include "locale.h" #include "tzfile.h" +#ifndef ZIC_MAX_ABBR_LEN_WO_WARN +#define ZIC_MAX_ABBR_LEN_WO_WARN 6 +#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */ + #if HAVE_SYS_STAT_H #include "sys/stat.h" #endif @@ -475,8 +479,7 @@ char * argv[]; (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); #endif /* defined unix */ #if HAVE_GETTEXT - (void) setlocale(LC_CTYPE, ""); - (void) setlocale(LC_MESSAGES, ""); + (void) setlocale(LC_ALL, ""); #ifdef TZ_DOMAINDIR (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); #endif /* defined TEXTDOMAINDIR */ @@ -2197,6 +2200,41 @@ const char * const string; { register int i; + if (strcmp(string, GRANDPARENTED) != 0) { + register const char * cp; + register char * wp; + + /* + ** Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics + ** optionally followed by a + or - and a number from 1 to 14. + */ + cp = string; + wp = NULL; + while (isascii(*cp) && isalpha(*cp)) + ++cp; + if (cp - string == 0) +wp = _("time zone abbreviation lacks alphabetic at start"); + if (noise && cp - string > 3) +wp = _("time zone abbreviation has more than 3 alphabetics"); + if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN) +wp = _("time zone abbreviation has too many alphabetics"); + if (wp == NULL && (*cp == '+' || *cp == '-')) { + ++cp; + if (isascii(*cp) && isdigit(*cp)) + if (*cp++ == '1' && *cp >= '0' && *cp <= '4') + ++cp; + } + if (*cp != '\0') +wp = _("time zone abbreviation differs from POSIX standard"); + if (wp != NULL) { + wp = ecpyalloc(wp); + wp = ecatalloc(wp, " ("); + wp = ecatalloc(wp, string); + wp = ecatalloc(wp, ")"); + warning(wp); + ifree(wp); + } + } i = strlen(string) + 1; if (charcnt + i > TZ_MAX_CHARS) { error(_("too many, or too long, time zone abbreviations")); diff --git a/timezone/zone.tab b/timezone/zone.tab index e3c8e39e1e..794c342a2d 100644 --- a/timezone/zone.tab +++ b/timezone/zone.tab @@ -1,8 +1,8 @@ -# @(#)zone.tab 1.30 +# @(#)zone.tab 1.31 # # TZ zone descriptions # -# From Paul Eggert <eggert@twinsun.com> (1996-08-05): +# From Paul Eggert (1996-08-05): # # This file contains a table with the following columns: # 1. ISO 3166 2-character country code. See the file `iso3166.tab'. diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h index ec61aac29a..fba18d9003 100644 --- a/wcsmbs/bits/wchar2.h +++ b/wcsmbs/bits/wchar2.h @@ -31,8 +31,8 @@ extern wchar_t *__REDIRECT_NTH (__wmemcpy_alias, wmemcpy); extern __always_inline wchar_t * -wmemcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, - size_t __n) +__NTH (wmemcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, + size_t __n)) { if (__bos0 (__s1) != (size_t) -1) return __wmemcpy_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); @@ -47,8 +47,8 @@ extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1, size_t __n), wmemmove); extern __always_inline wchar_t * -wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, - size_t __n) +__NTH (wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, + size_t __n)) { if (__bos0 (__s1) != (size_t) -1) return __wmemmove_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); @@ -66,8 +66,8 @@ extern wchar_t *__REDIRECT_NTH (__wmempcpy_alias, size_t __n), wmempcpy); extern __always_inline wchar_t * -wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, - size_t __n) +__NTH (wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, + size_t __n)) { if (__bos0 (__s1) != (size_t) -1) return __wmempcpy_chk (__s1, __s2, __n, __bos0 (__s1) / sizeof (wchar_t)); @@ -82,7 +82,7 @@ extern wchar_t *__REDIRECT_NTH (__wmemset_alias, (wchar_t *__s, wchar_t __c, size_t __n), wmemset); extern __always_inline wchar_t * -wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n) +__NTH (wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n)) { if (__bos0 (__s) != (size_t) -1) return __wmemset_chk (__s, __c, __n, __bos0 (__s) / sizeof (wchar_t)); @@ -98,7 +98,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy_alias, __const wchar_t *__restrict __src), wcscpy); extern __always_inline wchar_t * -wcscpy (wchar_t *__dest, __const wchar_t *__src) +__NTH (wcscpy (wchar_t *__dest, __const wchar_t *__src)) { if (__bos (__dest) != (size_t) -1) return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); @@ -113,7 +113,7 @@ extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__dest, wcpcpy); extern __always_inline wchar_t * -wcpcpy (wchar_t *__dest, __const wchar_t *__src) +__NTH (wcpcpy (wchar_t *__dest, __const wchar_t *__src)) { if (__bos (__dest) != (size_t) -1) return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); @@ -130,7 +130,7 @@ extern wchar_t *__REDIRECT_NTH (__wcsncpy_alias, size_t __n), wcsncpy); extern __always_inline wchar_t * -wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n) +__NTH (wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1 && (!__builtin_constant_p (__n) || __bos (__dest) >= __n)) @@ -149,7 +149,7 @@ extern wchar_t *__REDIRECT_NTH (__wcpncpy_alias, size_t __n), wcpncpy); extern __always_inline wchar_t * -wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n) +__NTH (wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1 && (!__builtin_constant_p (__n) || __bos (__dest) >= __n)) @@ -167,7 +167,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscat_alias, __const wchar_t *__restrict __src), wcscat); extern __always_inline wchar_t * -wcscat (wchar_t *__dest, __const wchar_t *__src) +__NTH (wcscat (wchar_t *__dest, __const wchar_t *__src)) { if (__bos (__dest) != (size_t) -1) return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); @@ -184,7 +184,7 @@ extern wchar_t *__REDIRECT_NTH (__wcsncat_alias, size_t __n), wcsncat); extern __always_inline wchar_t * -wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n) +__NTH (wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n)) { if (__bos (__dest) != (size_t) -1) return __wcsncat_chk (__dest, __src, __n, @@ -218,8 +218,8 @@ extern int __REDIRECT_NTH (__vswprintf_alias, extern __always_inline int -vswprintf (wchar_t *__s, size_t __n, __const wchar_t *__format, - __gnuc_va_list __arg) +__NTH (vswprintf (wchar_t *__s, size_t __n, __const wchar_t *__format, + __gnuc_va_list __arg)) { if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __bos (__s), @@ -293,7 +293,7 @@ extern size_t __REDIRECT_NTH (__wcrtomb_alias, mbstate_t *__restrict __ps), wcrtomb) __wur; extern __always_inline __wur size_t -wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps) +__NTH (wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps)) { /* We would have to include <limits.h> to get a definition of MB_LEN_MAX. But this would only disturb the namespace. So we define our own @@ -319,8 +319,8 @@ extern size_t __REDIRECT_NTH (__mbsrtowcs_alias, mbsrtowcs); extern __always_inline size_t -mbsrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src, - size_t __len, mbstate_t *__restrict __ps) +__NTH (mbsrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src, + size_t __len, mbstate_t *__restrict __ps)) { if (__bos (__dst) != (size_t) -1 && (!__builtin_constant_p (__len) @@ -341,8 +341,8 @@ extern size_t __REDIRECT_NTH (__wcsrtombs_alias, wcsrtombs); extern __always_inline size_t -wcsrtombs (char *__restrict __dst, __const wchar_t **__restrict __src, - size_t __len, mbstate_t *__restrict __ps) +__NTH (wcsrtombs (char *__restrict __dst, __const wchar_t **__restrict __src, + size_t __len, mbstate_t *__restrict __ps)) { if (__bos (__dst) != (size_t) -1 && (!__builtin_constant_p (__len) || __len > __bos (__dst))) @@ -363,8 +363,8 @@ extern size_t __REDIRECT_NTH (__mbsnrtowcs_alias, mbsnrtowcs); extern __always_inline size_t -mbsnrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src, - size_t __nmc, size_t __len, mbstate_t *__restrict __ps) +__NTH (mbsnrtowcs (wchar_t *__restrict __dst, __const char **__restrict __src, + size_t __nmc, size_t __len, mbstate_t *__restrict __ps)) { if (__bos (__dst) != (size_t) -1 && (!__builtin_constant_p (__len) @@ -386,8 +386,8 @@ extern size_t __REDIRECT_NTH (__wcsnrtombs_alias, mbstate_t *__restrict __ps), wcsnrtombs); extern __always_inline size_t -wcsnrtombs (char *__restrict __dst, __const wchar_t **__restrict __src, - size_t __nwc, size_t __len, mbstate_t *__restrict __ps) +__NTH (wcsnrtombs (char *__restrict __dst, __const wchar_t **__restrict __src, + size_t __nwc, size_t __len, mbstate_t *__restrict __ps)) { if (__bos (__dst) != (size_t) -1 && (!__builtin_constant_p (__len) || __len > __bos (__dst))) |