about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog38
-rw-r--r--Makerules4
-rw-r--r--PROJECTS20
-rw-r--r--dirent/dirent.h6
-rw-r--r--grp/grp.h6
-rw-r--r--intl/Makefile2
-rw-r--r--posix/unistd.h3
-rw-r--r--pwd/pwd.h6
-rw-r--r--stdio-common/bug7.c72
-rw-r--r--stdio-common/tmpnam.c34
-rw-r--r--stdio-common/tmpnam_r.c28
-rw-r--r--string/string.h4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h7
-rw-r--r--sysdeps/unix/sysv/linux/net/if.h5
-rw-r--r--sysdeps/unix/sysv/linux/net/if_arp.h4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/clone.S3
-rw-r--r--sysdeps/unix/sysv/linux/sys/kernel_termios.h7
-rw-r--r--time/Makefile32
-rw-r--r--time/mktime.c9
-rw-r--r--time/time.h10
-rw-r--r--time/tzfile.c14
21 files changed, 203 insertions, 111 deletions
diff --git a/ChangeLog b/ChangeLog
index 338352f251..c19819349b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+1997-01-23  Paul Eggert  <eggert@twinsun.com>
+
+	* mktime.c (mktime): Invoke __tzset, not __tzset_internal, to set tz,
+	so that tzname is set as POSIX requires.
+
+Fri Jan 24 02:49:18 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* dirent/dirent.h: Declare readdir_r also when __USE_POSIX.
+	* grp/grp.h: Declare *_r functions also when __USE_POSIX.
+	* pwd/pwd.h: Likewise.
+	* time/time.h: Likewise.
+	* posix/unistd.h: Declare ttyname_r also when __USE_POSIX.
+	* string/string.h: Declare strtok_r also when __USE_POSIX.
+
+	* stdio-common/bug7.c: Use tmpnam to generate names for test files.
+
+	* stdio-common/tmpnam.c: Update copyright.
+	* stdio-common/tmpnam_r.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h: Protect
+	against multiple inclusion.  Include <termbits.h>.
+	* sysdeps/unix/sysv/linux/sys/kernel_termios.h: Likewise.
+
+	* sysdeps/unix/sysv/linux/net/if.h: Update according to recent
+	kernel headers.  Patch by Philip Blundell <pjb27@cam.ac.uk>.
+
+Thu Jan 23 17:42:00 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/unix/sysv/linux/sparc/clone.S: Correct author attribution.
+
+	* sysdeps/unix/sysv/linux/net/if_arp (MAX_ADDR_LEN): Add definition.
+
+Thu Jan 23 14:20:34 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* time/tzfile.c (__tzfile_read): Don't allow arbitrary files to be
+	read when running a setuid program.
+
 Thu Jan 23 04:06:42 1997  Ulrich Drepper  <drepper@cygnus.com>
 
 	* Make-dist (.PHONY: dist): Remove duplicate declaration.
@@ -85,7 +122,6 @@ Wed Jan 22 13:19:56 1997  Richard Henderson  <rth@tamu.edu>
 Wed Jan 22 23:05:14 1997  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/mach/hurd/vdprintf.c: Complete de-ANSI-declfication.
-	* sysdeps/posix/pipestream.c (writedecl): Fix typo.
 	Reported by Marcus G. Daniels <marcus@shannon.sysc.pdx.edu>.
 
 Wed Jan 22 13:58:56 1997  Andreas Jaeger  <aj@arthur.pfalz.de>
diff --git a/Makerules b/Makerules
index 95e1cbcb0f..a8509bccfc 100644
--- a/Makerules
+++ b/Makerules
@@ -749,8 +749,8 @@ ifdef install-lib
 install-lib.a := $(filter lib%.a,$(install-lib))
 install-lib-non.a := $(filter-out lib%.a,$(install-lib))
 ifdef install-lib-non.a
-$(addprefix $(libdir)/$(libprefix),$(install-lib-non.a)): \
-  $(libdir)/$(libprefix)%: $(objpfx)%
+$(addprefix $(inst_libdir)/$(libprefix),$(install-lib-non.a)): \
+  $(inst_libdir)/$(libprefix)%: $(objpfx)%
 	$(do-install)
 endif
 ifdef install-lib.a
diff --git a/PROJECTS b/PROJECTS
index b7272eee90..ea1c208161 100644
--- a/PROJECTS
+++ b/PROJECTS
@@ -1,6 +1,6 @@
 Open jobs for finishing GNU libc:
 ---------------------------------
-Status: October 1996
+Status: January 1997
 
 If you have time and talent to take over any of the jobs below please
 contact <bug-glibc@prep.ai.mit.edu>
@@ -10,6 +10,8 @@ contact <bug-glibc@prep.ai.mit.edu>
 [ 1] Port to new platforms or test current version on formerly supported
      platforms.
 
+**** See http://www.gnu.org/software/libc/porting.html for more details.
+
 
 [ 2] Test compliance with standards.  If you have access to recent
      standards (IEEE, ISO, ANSI, X/Open, ...) and/or test suites you
@@ -31,6 +33,8 @@ contact <bug-glibc@prep.ai.mit.edu>
 
      Implementation idea: use some functions from bash.
 
+**** Somebody is working on this.  Help may or may not be appreciated.
+
 
 [ 5] Write `long double' versions of the math functions.  This should be
      done in collaboration with the NetBSD and FreeBSD people.
@@ -83,5 +87,15 @@ contact <bug-glibc@prep.ai.mit.edu>
 [11] Rewrite utmp/wtmp functions to use database functions.  This is much
      better than the normal flat file format.
 
-     Please contact bug-glibc@prep.ai.mit.edu before starting to avoid
-     duplicated work.
+**** There are plans for a new approach to this problem.  Please contact
+     bug-glibc@prep.ai.mit.edu before starting to work.)
+
+
+[12] Several more or less small functions have to be written:
+
+     + tcgetid() and waitid()			from XPG4.2
+     + grantpt(), ptsname(), unlockpt()		from XPG4.2
+     + getdate()				from XPG4.2
+     + fmtmsg()					from SVID
+
+     More information are available on request.
diff --git a/dirent/dirent.h b/dirent/dirent.h
index ac85b5f1c6..b5568b3c5a 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
@@ -116,14 +116,14 @@ extern int closedir __P ((DIR *__dirp));
 extern struct dirent *__readdir __P ((DIR *__dirp));
 extern struct dirent *readdir __P ((DIR *__dirp));
 
-#ifdef __USE_REENTRANT
+#if defined __USE_POSIX || defined __USE_REENTRANT
 /* Reentrant version of `readdir'.  Return in RESULT a pointer to the
    next entry.  */
 extern int __readdir_r __P ((DIR *__dirp, struct dirent *entry,
 			     struct dirent **result));
 extern int readdir_r __P ((DIR *__dirp, struct dirent *entry,
 			   struct dirent **result));
-#endif
+#endif	/* POSIX or reentrant */
 
 /* Rewind DIRP to the beginning of the directory.  */
 extern void rewinddir __P ((DIR *__dirp));
diff --git a/grp/grp.h b/grp/grp.h
index 164bdd78a9..93ed68848b 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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
@@ -91,7 +91,7 @@ extern struct group *getgrgid __P ((__gid_t __gid));
 /* Search for an entry with a matching group name.  */
 extern struct group *getgrnam __P ((__const char *__name));
 
-#ifdef	__USE_REENTRANT
+#if defined __USE_POSIX || defined __USE_REENTRENT
 /* Reasonable value for the buffer sized used in the reentrant
    functions below.  But better use `sysconf'.  */
 #define	NSS_BUFLEN_GROUP	1024
@@ -132,7 +132,7 @@ extern int fgetgrent_r __P ((FILE * __stream, struct group *__resultbuf,
 			     struct group **__result));
 #endif
 
-#endif	/* reentrant */
+#endif	/* POSIX or reentrant */
 
 
 #ifdef	__USE_BSD
diff --git a/intl/Makefile b/intl/Makefile
index db4db7c16c..8f411fba96 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -32,7 +32,7 @@ include ../Rules
 CPPFLAGS += -D'GNULOCALEDIR="$(localedir)"' \
 	    -D'LOCALE_ALIAS_PATH="$(localedir):$(i18ndir)"'
 
-$(localedir)/locale.alias: locale.alias
+$(inst_localedir)/locale.alias: locale.alias
 	$(do-install)
 
 ifdef gettext-srcdir
diff --git a/posix/unistd.h b/posix/unistd.h
index cfa53c7c8d..5c8d1b7f04 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -552,12 +552,11 @@ extern __pid_t vfork __P ((void));
 /* Return the pathname of the terminal FD is open on, or NULL on errors.
    The returned storage is good only until the next call to this function.  */
 extern char *ttyname __P ((int __fd));
-#ifdef __USE_REENTRANT
+
 /* Store at most BUFLEN characters of the pathname of the terminal FD is
    open on in BUF.  Return 0 on success, -1 otherwise.  */
 extern int __ttyname_r __P ((int __fd, char *__buf, size_t __buflen));
 extern int ttyname_r __P ((int __fd, char *__buf, size_t __buflen));
-#endif
 
 /* Return 1 if FD is a valid descriptor associated
    with a terminal, zero if not.  */
diff --git a/pwd/pwd.h b/pwd/pwd.h
index 89cd03f95a..68792d8a4b 100644
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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
@@ -94,7 +94,7 @@ extern struct passwd *getpwuid __P ((__uid_t __uid));
 /* Search for an entry with a matching username.  */
 extern struct passwd *getpwnam __P ((__const char *__name));
 
-#ifdef	__USE_REENTRANT
+#if defined __USE_POSIX || defined __USE_REENTRANT
 /* Reasonable value for the buffer sized used in the reentrant
    functions below.  But better use `sysconf'.  */
 #define	NSS_BUFLEN_PASSWD	1024
@@ -140,7 +140,7 @@ extern int fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
 			     struct passwd **__result));
 #endif
 
-#endif	/* reentrant */
+#endif	/* POSIX or reentrant */
 
 
 __END_DECLS
diff --git a/stdio-common/bug7.c b/stdio-common/bug7.c
index 7b320aebd2..2b1efe3bc6 100644
--- a/stdio-common/bug7.c
+++ b/stdio-common/bug7.c
@@ -6,50 +6,62 @@ int
 main (int argc, char *argv[])
 {
   int lose = 0;
-  char filename[] = "/tmp/foo";
+  char filename[L_tmpnam];
   FILE *fp;
 
-  fp = fopen (filename, "w+");
-  fprintf (fp, "Hello world!\n");
-  fflush (fp);
-  fseek (fp, 5L, SEEK_SET);
-  if (fseek (fp, -1L, SEEK_CUR) < 0)
+  if (tmpnam (filename) == NULL)
     {
-      printf ("seek failed\n");
+      printf ("tmpnam failed\n");
       lose = 1;
     }
-  fclose (fp);
-  remove (filename);
+  else
+    {
+      fp = fopen (filename, "w+");
+      fprintf (fp, "Hello world!\n");
+      fflush (fp);
+      fseek (fp, 5L, SEEK_SET);
+      if (fseek (fp, -1L, SEEK_CUR) < 0)
+	{
+	  printf ("seek failed\n");
+	  lose = 1;
+	}
+      fclose (fp);
+      remove (filename);
+    }
 
   {
     FILE *file1;
     FILE *file2;
-    char filename1[] = "/tmp/foo";
-    char filename2[] = "/tmp/bar";
+    char filename1[L_tmpnam];
+    char filename2[L_tmpnam];
     int ch;
 
-    file1 = fopen (filename1, "w");
-    fclose (file1);
-
-    file2 = fopen (filename2, "w");
-    fputc ('x', file2);
-    fclose (file2);
-
-    file1 = fopen (filename1, "r");
-    file2 = freopen (filename2, "r", file1);
-    if ((ch = fgetc (file2)) != 'x')
+    if (tmpnam (filename1) == NULL || tmpnam (filename2) == NULL)
       {
-	printf ("wrong character in reopened file, value = %d\n", ch);
+	printf ("tmpnam failed\n");
 	lose = 1;
       }
-#if 0
-    /* Hey, how did this ever worked?  `file1' is already closed!!!
-       -- drepper@gnu  */
-    fclose (file1);
-#endif
-    fclose (file2);
-    remove (filename1);
-    remove (filename2);
+    else
+      {
+
+	file1 = fopen (filename1, "w");
+	fclose (file1);
+
+	file2 = fopen (filename2, "w");
+	fputc ('x', file2);
+	fclose (file2);
+
+	file1 = fopen (filename1, "r");
+	file2 = freopen (filename2, "r", file1);
+	if ((ch = fgetc (file2)) != 'x')
+	  {
+	    printf ("wrong character in reopened file, value = %d\n", ch);
+	    lose = 1;
+	  }
+	fclose (file2);
+	remove (filename1);
+	remove (filename2);
+      }
   }
 
   puts (lose ? "Test FAILED!" : "Test succeeded.");
diff --git a/stdio-common/tmpnam.c b/stdio-common/tmpnam.c
index 0f2199ea60..6e6dd510ea 100644
--- a/stdio-common/tmpnam.c
+++ b/stdio-common/tmpnam.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 1993, 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+/* Copyright (C) 1991, 1993, 1996, 1997 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <stdio.h>
 #include <string.h>
diff --git a/stdio-common/tmpnam_r.c b/stdio-common/tmpnam_r.c
index 2794e7728e..a509a071d6 100644
--- a/stdio-common/tmpnam_r.c
+++ b/stdio-common/tmpnam_r.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1993, 1996, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <stdio.h>
 #include <string.h>
diff --git a/string/string.h b/string/string.h
index 4560f612b5..99fb2d83aa 100644
--- a/string/string.h
+++ b/string/string.h
@@ -138,12 +138,14 @@ extern char *strstr __P ((__const char *__haystack, __const char *__needle));
 /* Divide S into tokens separated by characters in DELIM.  */
 extern char *strtok __P ((char *__s, __const char *__delim));
 
-#ifdef	__USE_GNU
+#if defined __USE_POSIX || defined __USE_REENTRANT
 /* Divide S into tokens separated by characters in DELIM.  Information
    passed between calls are stored in SAVE_PTR.  */
 extern char *strtok_r __P ((char *__s, __const char *__delim,
 			    char **__save_ptr));
+#endif
 
+#ifdef __USE_GNU
 /* Find the first occurrence of NEEDLE in HAYSTACK.
    NEEDLE is NEEDLELEN bytes long;
    HAYSTACK is HAYSTACKLEN bytes long.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h b/sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h
index eebe976ce1..4be759a51f 100644
--- a/sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h
@@ -1,5 +1,10 @@
+#ifndef _SYS_KERNEL_TERMIOS_H
+#define _SYS_KERNEL_TERMIOS_H 1
 /* The following corresponds to the values from the Linux 2.1.20 kernel.  */
 
+/* We need the definition of tcflag_t, cc_t, and speed_t.  */
+#include <termbits.h>
+
 #define __KERNEL_NCCS 19
 
 struct __kernel_termios
@@ -16,3 +21,5 @@ struct __kernel_termios
 
 #define _HAVE_C_ISPEED 1
 #define _HAVE_C_OSPEED 1
+
+#endif /* sys/kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/net/if.h b/sysdeps/unix/sysv/linux/net/if.h
index bf261175ec..db86d20f23 100644
--- a/sysdeps/unix/sysv/linux/net/if.h
+++ b/sysdeps/unix/sysv/linux/net/if.h
@@ -105,7 +105,7 @@ struct ifreq
 	struct sockaddr ifru_netmask;
 	struct sockaddr ifru_hwaddr;
 	short int ifru_flags;
-	int ifru_metric;
+	int ifru_ivalue;
 	int ifru_mtu;
 	struct ifmap ifru_map;
 	char ifru_slave[IFNAMSIZ];	/* Just fits the size */
@@ -120,11 +120,12 @@ struct ifreq
 #define	ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address	*/
 #define	ifr_netmask	ifr_ifru.ifru_netmask	/* interface net mask	*/
 #define	ifr_flags	ifr_ifru.ifru_flags	/* flags		*/
-#define	ifr_metric	ifr_ifru.ifru_metric	/* metric		*/
+#define	ifr_metric	ifr_ifru.ifru_ivalue	/* metric		*/
 #define	ifr_mtu		ifr_ifru.ifru_mtu	/* mtu			*/
 #define ifr_map		ifr_ifru.ifru_map	/* device map		*/
 #define ifr_slave	ifr_ifru.ifru_slave	/* slave device		*/
 #define	ifr_data	ifr_ifru.ifru_data	/* for use by interface	*/
+#define ifr_ifindex	ifr_ifru.ifru_ivalue    /* interface index      */
 
 
 /* Structure used in SIOCGIFCONF request.  Used to retrieve interface
diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h
index ae0e799fb6..cf48f10f79 100644
--- a/sysdeps/unix/sysv/linux/net/if_arp.h
+++ b/sysdeps/unix/sysv/linux/net/if_arp.h
@@ -29,6 +29,10 @@
 
 __BEGIN_DECLS
 
+/* Some internals from deep down in the kernel.  */
+#define MAX_ADDR_LEN	7
+
+
 /* This structure defines an ethernet arp header.  */
 
 /* ARP protocol opcodes. */
diff --git a/sysdeps/unix/sysv/linux/sparc/clone.S b/sysdeps/unix/sysv/linux/sparc/clone.S
index 9e1ba812b0..64735e9dbc 100644
--- a/sysdeps/unix/sysv/linux/sparc/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/clone.S
@@ -1,6 +1,5 @@
 /* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-   Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx)
-   Based on code written for the Intel by Richard Henderson (rth@tamu.edu).
+   Contributed by Richard Henderson (rth@tamu.edu).
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
diff --git a/sysdeps/unix/sysv/linux/sys/kernel_termios.h b/sysdeps/unix/sysv/linux/sys/kernel_termios.h
index 95349760f0..629508e765 100644
--- a/sysdeps/unix/sysv/linux/sys/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/sys/kernel_termios.h
@@ -1,5 +1,10 @@
+#ifndef _SYS_KERNEL_TERMIOS_H
+#define _SYS_KERNEL_TERMIOS_H 1
 /* The following corresponds to the values from the Linux 2.1.20 kernel.  */
 
+/* We need the definition of tcflag_t, cc_t, and speed_t.  */
+#include <termbits.h>
+
 #define __KERNEL_NCCS 19
 
 struct __kernel_termios
@@ -11,3 +16,5 @@ struct __kernel_termios
     cc_t c_line;		/* line discipline */
     cc_t c_cc[__KERNEL_NCCS];	/* control characters */
   };
+
+#endif /* sys/kernel_termios.h */
diff --git a/time/Makefile b/time/Makefile
index 7f8513cc6a..b994eee1ac 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -91,22 +91,22 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
 # Kludge alert: we use an implicit rule (in what we are generating here)
 # because that is the only way to tell Make that the one command builds all
 # the files.
-	(echo 'define $*-zones'						;\
-	 awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\
-	 echo 'endef'							;\
-	 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))'		;\
-	 echo 'ifdef $*-zones'						;\
-	 echo '$$(addprefix $$(datadir)/zone%/right/,$$($*-zones)): \'	;\
-	 echo '$< $$(objpfx)zic leapseconds yearistype'			;\
-	 echo '	$$(tzcompile)'						;\
-	 echo '$$(addprefix $$(datadir)/zone%/posix/,$$($*-zones)): \'	;\
-	 echo '$< $$(objpfx)zic /dev/null yearistype'			;\
-	 echo '	$$(tzcompile)'						;\
-	 echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \'	;\
-	 echo '$< $$(objpfx)zic $$(leapseconds) yearistype'		;\
-	 echo '	$$(tzcompile)'						;\
-	 echo 'endif'							;\
-	 echo 'zonenames := $$(zonenames) $$($*-zones)'			;\
+	(echo 'define $*-zones'						    ;\
+	 awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^   ;\
+	 echo 'endef'							    ;\
+	 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))'		    ;\
+	 echo 'ifdef $*-zones'						    ;\
+	 echo '$$(addprefix $$(inst_datadir)/zone%/right/,$$($*-zones)): \' ;\
+	 echo '$< $$(objpfx)zic leapseconds yearistype'			    ;\
+	 echo '	$$(tzcompile)'						    ;\
+	 echo '$$(addprefix $$(inst_datadir)/zone%/posix/,$$($*-zones)): \' ;\
+	 echo '$< $$(objpfx)zic /dev/null yearistype'			    ;\
+	 echo '	$$(tzcompile)'						    ;\
+	 echo '$$(addprefix $$(inst_datadir)/zone%/,$$($*-zones)): \'	    ;\
+	 echo '$< $$(objpfx)zic $$(leapseconds) yearistype'		    ;\
+	 echo '	$$(tzcompile)'						    ;\
+	 echo 'endif'							    ;\
+	 echo 'zonenames := $$(zonenames) $$($*-zones)'			    ;\
 	) > $@.new
 	mv $@.new $@
 
diff --git a/time/mktime.c b/time/mktime.c
index 223872f228..fd242b1545 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -85,9 +85,6 @@
   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
 #endif
 
-/* Prototype for the internal function to get information based on TZ.  */
-extern void __tzset_internal __P ((int always));
-
 /* How many days come before each month (0-12).  */
 const unsigned short int __mon_yday[2][13] =
   {
@@ -164,8 +161,10 @@ mktime (tp)
      struct tm *tp;
 {
 #ifdef _LIBC
-  /* Update internal database according to current TZ setting.  */
-  __tzset_internal (1);
+  /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
+     time zone names contained in the external variable `tzname' shall
+     be set as if the tzset() function had been called.  */
+  __tzset ();
 #endif
 
   return __mktime_internal (tp, localtime_r, &localtime_offset);
diff --git a/time/time.h b/time/time.h
index d12236fdf2..681b6007d8 100644
--- a/time/time.h
+++ b/time/time.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
@@ -171,7 +171,7 @@ extern struct tm *gmtime __P ((__const time_t *__timer));
    of *TIMER in the local timezone.  */
 extern struct tm *localtime __P ((__const time_t *__timer));
 
-#ifdef	__USE_REENTRANT
+#if defined __USE_POSIX || defined __USE_REENTRANT
 /* Return the `struct tm' representation of *TIMER in UTC,
    using *TP to store the result.  */
 extern struct tm *__gmtime_r __P ((__const time_t *__timer,
@@ -185,7 +185,7 @@ extern struct tm *__localtime_r __P ((__const time_t *__timer,
 				      struct tm *__tp));
 extern struct tm *localtime_r __P ((__const time_t *__timer,
 				    struct tm *__tp));
-#endif	/* reentrant */
+#endif	/* POSIX or reentrant */
 
 /* Compute the `struct tm' representation of *T,
    offset OFFSET seconds east of UTC,
@@ -201,7 +201,7 @@ extern char *asctime __P ((__const struct tm *__tp));
 /* Equivalent to `asctime (localtime (timer))'.  */
 extern char *ctime __P ((__const time_t *__timer));
 
-#ifdef	__USE_REENTRANT
+#if defined __USE_POSIX || defined __USE_REENTRANT
 /* Reentrant versions of the above functions.  */
 
 /* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
@@ -211,7 +211,7 @@ extern char *asctime_r __P ((__const struct tm *__tp, char *__buf));
 
 /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'.  */
 extern char *ctime_r __P ((__const time_t *__timer, char *__buf));
-#endif	/* reentrant */
+#endif	/* POSIX or reentrant */
 
 
 /* Defined in localtime.c.  */
diff --git a/time/tzfile.c b/time/tzfile.c
index 761ddc9539..ed7b0932f3 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -21,6 +21,7 @@
 #include <time.h>
 #include <string.h>
 #include <limits.h>
+#include <unistd.h>
 
 #define	NOID
 #include <tzfile.h>
@@ -79,6 +80,7 @@ decode (const void *ptr)
 void
 __tzfile_read (const char *file)
 {
+  static const char default_tzdir[] = TZDIR;
   size_t num_isstd, num_isgmt;
   register FILE *f;
   struct tzhead tzhead;
@@ -111,9 +113,19 @@ __tzfile_read (const char *file)
     /* User specified the empty string; use UTC explicitly.  */
     file = "Universal";
 
+  /* We must not allow to read an arbitrary file in a setuid program.
+     So we fail for any file which is not in the directory hierachy
+     starting at TZDIR.  */
+  if (__libc_enable_secure
+      && ((*file == '/'
+	   && memcmp (file, default_tzdir, sizeof (default_tzdir) - 1) != 0)
+	  || strstr (file, "../") != NULL))
+    /* This test a certainly a bit too restrictive but it should catch all
+       critical case.  */
+    return;
+
   if (*file != '/')
     {
-      static const char default_tzdir[] = TZDIR;
       const char *tzdir;
       unsigned int len, tzdir_len;
       char *new;