about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog38
-rw-r--r--Makefile8
-rw-r--r--dirent/scandir.c3
-rw-r--r--elf/dl-object.c1
-rw-r--r--hurd/hurdstartup.c63
-rw-r--r--locale/locale.c1
-rw-r--r--locale/localedef.c1
-rw-r--r--locale/locfile-parse.c1
-rw-r--r--manual/time.texi37
-rw-r--r--misc/mntent.c10
-rw-r--r--misc/search.h101
-rw-r--r--posix/execvp.c1
-rw-r--r--stdio/fclose.c3
-rw-r--r--stdio/getdelim.c1
-rw-r--r--stdio/memstream.c3
-rw-r--r--stdio/setvbuf.c3
-rw-r--r--stdlib/jrand48_r.c7
-rw-r--r--stdlib/lcong48_r.c7
-rw-r--r--stdlib/msort.c1
-rw-r--r--stdlib/nrand48_r.c7
-rw-r--r--stdlib/seed48_r.c7
-rw-r--r--stdlib/srand48_r.c7
-rw-r--r--sysdeps/generic/setenv.c3
-rw-r--r--sysdeps/ieee754/ldexp.c1
-rw-r--r--sysdeps/posix/system.c3
25 files changed, 228 insertions, 90 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d5b4c7da0..7f26c55939 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,42 @@
+Wed Sep 20 18:02:03 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
+
+	* locale/locale.c: Include errno.h.
+	* locale/localedef.c: Likewise.
+
+Tue Sep 19 00:02:06 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
+
+	* Makefile (distclean-1): Remove config.cache, config.log, config.h.
+	(parent-mostlyclean): Remove all flavors of the parent library.
+
+	* misc/mntent.c (getmntent): Skip multiple whitespace chars
+	between fields.
+
+	* hurd/hurdstartup.c (_hurd_startup): If RPC returns
+	EXEC_STACK_ARGS flag, get args from stack.
+	If args on stack but have info from RPC, relocate args on stack to make
+	space for struct hurd_startup_data.
+
 Mon Sep 18 15:06:00 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
+	* elf/dl-object.c: Include errno.h.
+	* posix/execvp.c: Likewise.
+	* dirent/scandir.c: Likewise.
+	* sysdeps/posix/system.c: Likewise.
+	* sysdeps/generic/setenv.c: Likewise.
+	* stdlib/msort.c: Likewise.
+	* stdio/memstream.c: Likewise.
+	* stdio/fclose.c: Likewise.
+	* stdio/getdelim.c: Likewise.
+	* stdio/setvbuf.c: Likewise.
+	* sysdeps/ieee754/ldexp.c: Likewise.
+	* locale/locfile-parse.c: Likewise.
+
+	* stdlib/lcong48_r.c: Don't check for null argument; let it fault.
+	* stdlib/seed48_r.c: Likewise.
+	* stdlib/srand48_r.c: Likewise.
+	* stdlib/jrand48_r.c: Likewise.
+	* stdlib/nrand48_r.c: Likewise.
+
 	* Makeconfig (+gccwarn): Remove -Wbad-function-cast, which seems
 	to be useless.
 
@@ -77,6 +114,7 @@ Sat Sep 16 17:47:19 1995  Ulrich Drepper  <drepper@ipd.info.uni-karlsruhe.de>
 
 	* misc/efgvt_r.c: New file.  Reentrant version of [efg]cvt functions.
 	* misc/efgcvt.c: Rewrite to use reentrant functions.
+	* misc/search.h: Many decls for hsearch functions.
 	* misc/hsearch_r.c: New file.  Reentrant version of functions from
 	hsearch family.
 	* misc/hsearch.c, misc/tsearch.c: New files.
diff --git a/Makefile b/Makefile
index 26a100cd8f..56601e5282 100644
--- a/Makefile
+++ b/Makefile
@@ -174,7 +174,9 @@ $(all-subdirs-targets):
 
 # Subroutines of all cleaning targets.
 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
-	-rm -f $(common-objpfx)libc.a $(addprefix $(objpfx),$(install-lib))
+	-rm -f $(foreach o,$(object-suffixes),\
+		   $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
+	       $(addprefix $(objpfx),$(install-lib))
 parent-clean: parent-mostlyclean common-clean
 	-rm -f $(addprefix $(common-objpfx),$(common-generated))
 	-rm -f $(addprefix $(objpfx),sysd-Makefile sysd-dirs sysd-rules)
@@ -200,8 +202,8 @@ realclean distclean: parent-clean
 # Subroutine of distclean and realclean.
 distclean-1: subdir_$(distclean-1)
 	-rm -f $(config-generated)
-	-rm -f $(addprefix $(objpfx),config.status cache.cache)
-	-rm -f $(addprefix $(objpfx),config.make config-name.h)
+	-rm -f $(addprefix $(objpfx),config.status config.cache config.log)
+	-rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
 ifdef objdir
 	-rm -f $(objpfx)Makefile
 endif
diff --git a/dirent/scandir.c b/dirent/scandir.c
index 6794eadf0d..65267affb7 100644
--- a/dirent/scandir.c
+++ b/dirent/scandir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1993, 1994, 1995 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
@@ -19,6 +19,7 @@ Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <dirent.h>
 #include <stdlib.h>
+#include <errno.h>
 
 int
 DEFUN(scandir, (dir, namelist, select, cmp),
diff --git a/elf/dl-object.c b/elf/dl-object.c
index ca4e785be3..11e9e082d2 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -21,6 +21,7 @@ Cambridge, MA 02139, USA.  */
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
+#include <errno.h>
 
 
 /* List of objects currently loaded.  */
diff --git a/hurd/hurdstartup.c b/hurd/hurdstartup.c
index 61b8cdf42b..28ce40bbed 100644
--- a/hurd/hurdstartup.c
+++ b/hurd/hurdstartup.c
@@ -99,13 +99,13 @@ _hurd_startup (void **argptr, void (*main) (int *data))
       __mach_port_deallocate (__mach_task_self (), in_bootstrap);
     }
 
-  if (err || in_bootstrap == MACH_PORT_NULL)
+  if (err || in_bootstrap == MACH_PORT_NULL || (data.flags & EXEC_STACK_ARGS))
     {
       /* Either we have no bootstrap port, or the RPC to the exec server
-	 failed.  Try to snarf the args in the canonical Mach way.
+	 failed, or whoever started us up passed the flag saying args are
+	 on the stack.  Try to snarf the args in the canonical Mach way.
 	 Hopefully either they will be on the stack as expected, or the
-	 stack will be zeros so we don't crash.  Set all our other
-	 variables to have empty information.  */
+	 stack will be zeros so we don't crash.  */
 
       argcptr = (int *) argptr;
       argc = argcptr[0];
@@ -114,26 +114,12 @@ _hurd_startup (void **argptr, void (*main) (int *data))
       envc = 0;
       while (envp[envc])
 	++envc;
-
-      data.flags = 0;
-      args = env = NULL;
-      argslen = envlen = 0;
-      data.dtable = NULL;
-      data.dtablesize = 0;
-      data.portarray = NULL;
-      data.portarraysize = 0;
-      data.intarray = NULL;
-      data.intarraysize = 0;
     }
   else
-    argv = envp = NULL;
-
-
-  /* Turn the block of null-separated strings we were passed for the
-     arguments and environment into vectors of pointers to strings.  */
-
-  if (! argv)
     {
+      /* Turn the block of null-separated strings we were passed for the
+	 arguments and environment into vectors of pointers to strings.  */
+
       /* Count up the arguments so we can allocate ARGV.  */
       argc = _hurd_split_args (args, argslen, NULL);
       /* Count up the environment variables so we can allocate ENVP.  */
@@ -155,6 +141,41 @@ _hurd_startup (void **argptr, void (*main) (int *data))
       _hurd_split_args (env, envlen, envp);
     }
 
+  if (err || in_bootstrap == MACH_PORT_NULL)
+    {
+      /* Either we have no bootstrap port, or the RPC to the exec server
+	 failed.  Set all our other variables to have empty information.  */
+
+      data.flags = 0;
+      args = env = NULL;
+      argslen = envlen = 0;
+      data.dtable = NULL;
+      data.dtablesize = 0;
+      data.portarray = NULL;
+      data.portarraysize = 0;
+      data.intarray = NULL;
+      data.intarraysize = 0;
+    }
+  else if ((void *) &envp[envc + 1] == argv[0])
+    {
+      /* The arguments arrived on the stack from the kernel, but our
+	 protocol requires some space after them for a `struct
+	 hurd_startup_data'.  Move them.  */
+      struct
+	{
+	  int count;
+	  char *argv[argc + 1];
+	  char *envp[envc + 1];
+	  struct hurd_startup_data data;
+	} *args = alloca (sizeof *args);
+      if ((void *) &args[1] == (void *) argcptr)
+	args = alloca (-((char *) &args->data - (char *) args));
+      memmove (args, argcptr, (char *) &args->data - (char *) args);
+      argcptr = (void *) args;
+      argv = args->argv;
+      envp = args->envp;
+    }
+
   {
     struct hurd_startup_data *d = (void *) &envp[envc + 1];
 
diff --git a/locale/locale.c b/locale/locale.c
index 20385f07d8..fd2e392e80 100644
--- a/locale/locale.c
+++ b/locale/locale.c
@@ -24,6 +24,7 @@ Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <errno.h>
 
 #include "localedef.h"
 
diff --git a/locale/localedef.c b/locale/localedef.c
index fceebc5635..56ec1a2f6d 100644
--- a/locale/localedef.c
+++ b/locale/localedef.c
@@ -24,6 +24,7 @@ Cambridge, MA 02139, USA.  */
 #include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#include <errno.h>
 #include "error.h"
 
 #include "localedef.h"
diff --git a/locale/locfile-parse.c b/locale/locfile-parse.c
index aad84334c9..daf56bcd45 100644
--- a/locale/locfile-parse.c
+++ b/locale/locfile-parse.c
@@ -15,6 +15,7 @@ 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.  */
 
+#include <errno.h>
 #include <assert.h>
 #include <dirent.h>
 #include <fcntl.h>
diff --git a/manual/time.texi b/manual/time.texi
index 767c318a42..3f8eee46a3 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -241,13 +241,15 @@ These facilities are declared in the header file @file{time.h}.
 @comment time.h
 @comment ANSI
 @deftp {Data Type} time_t
-This is the data type used to represent calendar time.  In the GNU C
-library and other POSIX-compliant implementations, @code{time_t} is
-equivalent to @code{long int}.  When interpreted as an absolute time
+This is the data type used to represent calendar time.
+When interpreted as an absolute time
 value, it represents the number of seconds elapsed since 00:00:00 on
 January 1, 1970, Coordinated Universal Time.  (This date is sometimes
-referred to as the @dfn{epoch}.)
+referred to as the @dfn{epoch}.)  POSIX requires that this count
+ignore leap seconds, but on some hosts this count includes leap seconds
+if you set @code{TZ} to certain values (@pxref{TZ Variable}).
 
+In the GNU C library, @code{time_t} is equivalent to @code{long int}.
 In other systems, @code{time_t} might be either an integer or
 floating-point type.
 @end deftp
@@ -257,7 +259,8 @@ floating-point type.
 @deftypefun double difftime (time_t @var{time1}, time_t @var{time0})
 The @code{difftime} function returns the number of seconds elapsed
 between time @var{time1} and time @var{time0}, as a value of type
-@code{double}.  
+@code{double}.  The difference ignores leap seconds unless leap
+second support is enabled.
 
 In the GNU system, you can simply subtract @code{time_t} values.  But on
 other systems, the @code{time_t} data type might use some other encoding
@@ -462,8 +465,8 @@ contains at least the following members, which can appear in any order:
 @table @code
 @item int tm_sec
 This is the number of seconds after the minute, normally in the range
-@code{0} to @code{59}.  (The actual upper limit is @code{61}, to allow
-for ``leap seconds''.)
+@code{0} to @code{59}.  (The actual upper limit is @code{60}, to allow
+for leap seconds if leap second support is available.)
 @cindex leap second
 
 @item int tm_min
@@ -508,7 +511,7 @@ also think of this as the ``number of seconds west'' of GMT.  The
 @code{tm_gmtoff} field is a GNU library extension.
 
 @item const char *tm_zone
-This field is the three-letter name for the time zone that was used to
+This field is the name for the time zone that was used to
 compute this broken-down time value.  It is a GNU library extension.
 @end table
 @end deftp
@@ -521,9 +524,9 @@ The @code{localtime} function converts the calendar time pointed to by
 user's specified time zone.
 
 The return value is a pointer to a static broken-down time structure, which
-might be overwritten by subsequent calls to any of the date and time
-functions.  (But no other library function overwrites the contents of this
-object.)
+might be overwritten by subsequent calls to @code{ctime}, @code{gmtime},
+or @code{localtime}.  (But no other library function overwrites the contents
+of this object.)
 
 Calling @code{localtime} has one other effect: it sets the variable
 @code{tzname} with information about the current time zone.  @xref{Time
@@ -590,7 +593,7 @@ The abbreviations for the months are: @samp{Jan}, @samp{Feb},
 @samp{Sep}, @samp{Oct}, @samp{Nov}, and @samp{Dec}.
 
 The return value points to a statically allocated string, which might be
-overwritten by subsequent calls to any of the date and time functions.
+overwritten by subsequent calls to @code{asctime} or @code{ctime}.
 (But no other library function overwrites the contents of this
 string.)
 @end deftypefun
@@ -870,7 +873,7 @@ community of volunteers and put in the public domain.
 @comment POSIX.1
 @deftypevar char * tzname [2]
 The array @code{tzname} contains two strings, which are the standard
-three-letter names of the pair of time zones (standard and daylight
+names of the pair of time zones (standard and daylight
 savings) that the user has selected.  @code{tzname[0]} is the name of
 the standard time zone (for example, @code{"EST"}), and @code{tzname[1]}
 is the name for the time zone when daylight savings time is in use (for
@@ -893,7 +896,7 @@ depend on the time zone.
 @end deftypefun
 
 The following variables are defined for compatibility with System V
-Unix.  These variables are set by calling @code{localtime}.
+Unix.  These variables are set by calling @code{tzset}.
 
 @comment time.h
 @comment SVID
@@ -906,8 +909,10 @@ seconds.  For example, in the U.S. Eastern time zone, the value is
 @comment time.h
 @comment SVID
 @deftypevar int daylight
-This variable has a nonzero value if the standard U.S. daylight savings
-time rules apply.
+This variable has a nonzero value if daylight savings time rules apply.
+A nonzero value does not necessarily mean that daylight savings time is
+now in effect; it means only that daylight savings time is sometimes in
+effect.
 @end deftypevar
 
 @node Time Functions Example
diff --git a/misc/mntent.c b/misc/mntent.c
index 42c20817ba..bdc6aaed79 100644
--- a/misc/mntent.c
+++ b/misc/mntent.c
@@ -53,14 +53,20 @@ getmntent (FILE *stream)
       if (getline (&buf, &bufsiz, stream) < 0)
 	return NULL;
 
-      head = buf;
+      head = buf + strspn (buf, " \t");
     } while (head[0] == '#');	/* Skip comment lines.  */
     
   m.mnt_fsname = strsep (&head, " \t") ?: (char *) "";
+  if (head)
+    head += strspn (head, " \t");
   m.mnt_dir = strsep (&head, " \t") ?: (char *) "";
+  if (head)
+    head += strspn (head, " \t");
   m.mnt_type = strsep (&head, " \t") ?: (char *) "";
+  if (head)
+    head += strspn (head, " \t");
   m.mnt_opts = strsep (&head, " \t") ?: (char *) "";
-  switch (sscanf (head, "%d %d\n", &m.mnt_freq, &m.mnt_passno))
+  switch (head ? sscanf (head, " %d %d\n", &m.mnt_freq, &m.mnt_passno) : 0)
     {
     case 0:
       m.mnt_freq = 0;
diff --git a/misc/search.h b/misc/search.h
index c6d18702ca..31c4f03a1f 100644
--- a/misc/search.h
+++ b/misc/search.h
@@ -1,4 +1,4 @@
-/* search.h -- declarations for `insque' and `remque'
+/* search.h -- declarations for System V style searching functions.
 Copyright (C) 1995 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
@@ -14,16 +14,18 @@ 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.  */
-
-/* These functions are provided for compatibility with BSD.  */
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 #ifndef _SEARCH_H
 #define	_SEARCH_H 1
 
 #include <sys/cdefs.h>
 
+#define __need_size_t
+#define __need_NULL
+#include <stddef.h>
+
 __BEGIN_DECLS
 
 /* Prototype structure for a linked-list data structure.
@@ -41,9 +43,94 @@ struct qelem
 extern void insque __P ((struct qelem *__elem, struct qelem *__prev));
 
 /* Unlink ELEM from the doubly-linked list that it is in.  */
-extern void remque __P ((struct qelem *elem));
+extern void remque __P ((struct qelem *__elem));
+
+
+/* For use with hsearch(3).  */
+#ifndef __COMPAR_FN_T
+#define __COMPAR_FN_T
+typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t));
+#endif
+
+/* Action which shall be performed in the call the hsearch.  */
+typedef enum
+  {
+    FIND,
+    ENTER
+  }
+ACTION;
+
+typedef struct entry
+  {
+    char *key;
+    char *data;
+  }
+ENTRY;
+
+/* Opaque type for internal use.  */
+struct _ENTRY;
+
+/* Data type for reentrent functions.  */
+struct hsearch_data
+  {
+    struct _ENTRY *table;
+    unsigned int size;
+    unsigned int filled;
+  };
+
+/* Family of hash table handling functions.  The functions also have
+   reentrent counterparts ending with _r.  */
+extern ENTRY *hsearch __P ((ENTRY __item, ACTION __action));
+extern int hcreate __P ((unsigned int __nel));
+extern void hdestroy __P ((void));
+
+extern int hsearch_r __P ((ENTRY __item, ACTION __action, ENTRY **__retval,
+			   struct hsearch_data *__htab));
+extern int hcreate_r __P ((unsigned int __nel, struct hsearch_data *htab));
+extern void hdestroy_r __P ((struct hsearch_data *htab));
+
+
+/* The tsearch routines are very interesting. They make many
+   assumptions about the compiler.  It assumpts that the first field
+   in node must be the "key" field, which points to the datum.
+   Everything depends on that.  */
+/* For tsearch */
+typedef enum
+{
+  preorder,
+  postorder,
+  endorder,
+  leaf
+}
+VISIT;
+
+extern void *tsearch __P ((__const void * __key, void **__rootp,
+			   __compar_fn_t compar));
+
+extern void *tfind __P ((__const void * __key, __const void ** __rootp,
+			 __compar_fn_t compar));
+
+extern void *tdelete __P ((__const void * __key, void ** __rootp,
+			   __compar_fn_t compar));
+
+#ifndef __ACTION_FN_T
+#define __ACTION_FN_T
+typedef void (*__action_fn_t) __P ((__const void *__nodep,
+				    __const VISIT __value,
+				    __const int __level));
+#endif
+
+extern void twalk __P ((__const void * __root, __action_fn_t action));
+
+
+extern void * lfind __P ((__const void * __key, __const void * __base,
+			  size_t * __nmemb, size_t __size,
+			  __compar_fn_t __compar));
 
+extern void * lsearch __P ((__const void * __key, __const void * __base,
+			    size_t * __nmemb, size_t __size,
+			    __compar_fn_t __compar));
 
 __END_DECLS
 
-#endif	/* search.h */
+#endif /* search.h */
diff --git a/posix/execvp.c b/posix/execvp.c
index 723e7fa503..17072ce844 100644
--- a/posix/execvp.c
+++ b/posix/execvp.c
@@ -20,6 +20,7 @@ Cambridge, MA 02139, USA.  */
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 /* Execute FILE, searching in the `PATH' environment variable if it contains
    no slashes, with arguments ARGV and environment from `environ'.  */
diff --git a/stdio/fclose.c b/stdio/fclose.c
index becb85802f..bcf4cd4163 100644
--- a/stdio/fclose.c
+++ b/stdio/fclose.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995 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
@@ -21,6 +21,7 @@ Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 
 /* Close a stream.  */
diff --git a/stdio/getdelim.c b/stdio/getdelim.c
index 8047c1fe0c..2cdb95c2a6 100644
--- a/stdio/getdelim.c
+++ b/stdio/getdelim.c
@@ -22,6 +22,7 @@ Cambridge, MA 02139, USA.  */
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
+#include <errno.h>
 
 /* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
    (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
diff --git a/stdio/memstream.c b/stdio/memstream.c
index 704eca53b3..1a8b35081d 100644
--- a/stdio/memstream.c
+++ b/stdio/memstream.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1994, 1995 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
@@ -20,6 +20,7 @@ Cambridge, MA 02139, USA.  */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 struct memstream_info
   {
diff --git a/stdio/setvbuf.c b/stdio/setvbuf.c
index 8c33386610..6bfe829d1d 100644
--- a/stdio/setvbuf.c
+++ b/stdio/setvbuf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995 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
@@ -20,6 +20,7 @@ Cambridge, MA 02139, USA.  */
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 
 
 /* Make STREAM use the buffering method given in MODE.
diff --git a/stdlib/jrand48_r.c b/stdlib/jrand48_r.c
index b1a4378028..1a89790525 100644
--- a/stdlib/jrand48_r.c
+++ b/stdlib/jrand48_r.c
@@ -25,13 +25,6 @@ jrand48_r (xsubi, buffer, result)
      struct drand48_data *buffer;
      long *result;
 {
-  /* Be generous for the arguments, detect some errors.  */
-  if (result == NULL)
-    {
-      errno = EFAULT;
-      return -1;
-    }
-
   /* Compute next state.  */
   if (__drand48_iterate (xsubi, buffer) < 0)
     return -1;
diff --git a/stdlib/lcong48_r.c b/stdlib/lcong48_r.c
index cc38b4dc7c..f607bc5b84 100644
--- a/stdlib/lcong48_r.c
+++ b/stdlib/lcong48_r.c
@@ -24,13 +24,6 @@ lcong48_r (param, buffer)
      unsigned short int param[7];
      struct drand48_data *buffer;
 {
-  /* Be generous for the arguments, detect some errors.  */
-  if (buffer == NULL)
-    {
-      errno = EFAULT;
-      return -1;
-    }
-
   /* Store the given values.  */
   memcpy (buffer->X, &param[0], sizeof (buffer->X));
   memcpy (buffer->a, &param[3], sizeof (buffer->a));
diff --git a/stdlib/msort.c b/stdlib/msort.c
index 21fbbfb2bf..e2834ce6ca 100644
--- a/stdlib/msort.c
+++ b/stdlib/msort.c
@@ -23,6 +23,7 @@ Cambridge, MA 02139, USA.  */
 #include <stdlib.h>
 #include <string.h>
 #include <memcopy.h>
+#include <errno.h>
 
 static void
 DEFUN(msort_with_tmp, (b, n, s, cmp, t),
diff --git a/stdlib/nrand48_r.c b/stdlib/nrand48_r.c
index 1bbc29e7ef..d5ebf35dd2 100644
--- a/stdlib/nrand48_r.c
+++ b/stdlib/nrand48_r.c
@@ -25,13 +25,6 @@ nrand48_r (xsubi, buffer, result)
      struct drand48_data *buffer;
      long *result;
 {
-  /* Be generous for the arguments, detect some errors.  */
-  if (result == NULL)
-    {
-      errno = EFAULT;
-      return -1;
-    }
-
   /* Compute next state.  */
   if (__drand48_iterate (xsubi, buffer) < 0)
     return -1;
diff --git a/stdlib/seed48_r.c b/stdlib/seed48_r.c
index 4d43507742..e45c3d2ad3 100644
--- a/stdlib/seed48_r.c
+++ b/stdlib/seed48_r.c
@@ -24,13 +24,6 @@ seed48_r (seed16v, buffer)
      unsigned short int seed16v[3];
      struct drand48_data *buffer;
 {
-  /* Be generous for the arguments, detect some errors.  */
-  if (buffer == NULL)
-    {
-      errno = EFAULT;
-      return -1;
-    }
-
   /* Save old value at a private place to be used as return value.  */
   memcpy (buffer->old_X, buffer->X, sizeof (buffer->X));
 
diff --git a/stdlib/srand48_r.c b/stdlib/srand48_r.c
index ac313f6c48..8720854249 100644
--- a/stdlib/srand48_r.c
+++ b/stdlib/srand48_r.c
@@ -24,13 +24,6 @@ srand48_r (seedval, buffer)
      long seedval;
      struct drand48_data *buffer;
 {
-  /* Be generous for the arguments, detect some errors.  */
-  if (buffer == NULL)
-    {
-      errno = EFAULT;
-      return -1;
-    }
-
   /* The standards say we only have 32 bits.  */
   if (sizeof (long) > 4)
     seedval &= 0xffffffffl;
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index a27f02e50a..1907a2b7e1 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995 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
@@ -20,6 +20,7 @@ Cambridge, MA 02139, USA.  */
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <errno.h>
 
 #ifndef	HAVE_GNU_LD
 #define	__environ	environ
diff --git a/sysdeps/ieee754/ldexp.c b/sysdeps/ieee754/ldexp.c
index 7e1c74715b..e8e3c676f9 100644
--- a/sysdeps/ieee754/ldexp.c
+++ b/sysdeps/ieee754/ldexp.c
@@ -38,6 +38,7 @@ Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <math.h>
 #include <float.h>
+#include <errno.h>
 #include "ieee754.h"
 
 double
diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c
index 69b004bb41..da58be51ae 100644
--- a/sysdeps/posix/system.c
+++ b/sysdeps/posix/system.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1994, 1995 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
@@ -23,6 +23,7 @@ Cambridge, MA 02139, USA.  */
 #include <sys/wait.h>
 #include <signal.h>
 #include <sys/types.h>
+#include <errno.h>
 
 
 #ifndef	HAVE_GNU_LD