aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-14 11:43:26 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-14 11:43:26 +0000
commit7ef90c1595a5687b5a48b789718ecd20742465bf (patch)
tree7e1292f068d02f0cd97adb57d0782db7f17cf062
parent5d47ceca3f6d10b36889b11609fb58f5305c4042 (diff)
downloadglibc-7ef90c1595a5687b5a48b789718ecd20742465bf.tar
glibc-7ef90c1595a5687b5a48b789718ecd20742465bf.tar.gz
glibc-7ef90c1595a5687b5a48b789718ecd20742465bf.tar.bz2
glibc-7ef90c1595a5687b5a48b789718ecd20742465bf.zip
Update.
1998-09-14 11:26 Ulrich Drepper <drepper@cygnus.com> * wcsmbs/wcsmbs-tst1.c: Include stdlib.h. 1998-09-14 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * libc-work/nis/nss_nisplus/nisplus-service.c (_nss_nisplus_parse_servent): Convert port in network byte order. 1998-09-14 07:53 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu> * stdlib/stdlib.h: Add a switch, __need_malloc_and_calloc, to provide only malloc and calloc. * include/stdlib.h: Support the above. * string/bits/string2.h: Use __need_malloc_and_calloc when including stdlib.h. (__string2_1bptr_p): Avoid -Wbad-function-cast warnings. * iconvdata/iso-2022-jp.c: Include <stdlib.h>. * iconvdata/iso646.c: Include <stdlib.h>. 1998-09-14 07:51 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu> * sunrpc/rpc_cout.c: Add braces around ambiguous else. * sysdeps/libm-ieee754/w_pow.c: Likewise. * sysdeps/libm-ieee754/w_powf.c: Likewise. * sysdeps/libm-ieee754/w_powl.c: Likewise. 1998-09-14 07:57 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu> * stdio-common/stdio_lim.h.in: New file. All parameters are adjustable at build time. * Rules: Add a rule to build bits/stdio_lim.h from stdio-common/stdio_lim.h.in. (It has to be in Rules so that all subdirectories know how to make the file. It can't be in Makerules because then it gets built at top level and the dependencies are wrong.) * stdio-common/Makefile (distribute): Add stdio_lim.h.in. * sysdeps/unix/sysv/linux/Makefile: Delete rules to make stdio_lim.h. * sysdeps/unix/sysv/linux/stdio_lim.h.in: Removed. * sysdeps/unix/sysv/linux/Dist: Take out stdio_lim.h.in. * sysdeps/posix/Makefile: Removed. * sysdeps/posix/mk-stdiolim.c: Removed. * sysdeps/generic/bits/stdio_lim.h: Removed. 1998-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * argp/argp-help.c: Fixup indentation. * nss/nss_files/files-alias.c: Quiet -Wparentheses warning. * resolv/nss_dns/dns-network.c: Likewise. * resolv/res_send.c: Likewise. * rt/aio_cancel.c: Likewise. * rt/aio_misc.c: Likewise. 1998-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makefile (install-symbolic-link): Remove the link list file at last. * Makerules (install-clean-symbolic-link-list): Removed. 1998-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * timezone/tst-timezone.c: Print time in UTC to get consistent output. 1998-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/rtld.c (_dl_rpath): Removed. * elf/dl-support.c (_dl_path): Removed. * elf/Makefile ($(objpfx)ld.so): Don't pass -rpath. (CFLAGS-dl-support.c): Removed. * elf/dl-load.c (env_path_list): Renamed from fake_path_list. All uses changed. (_dl_init_paths): Always set env_path_list from LD_LIBRARY_PATH, instead of appending it to the main map's rpath info. (_dl_map_object): Consistently use LD_LIBRARY_PATH after all DT_RPATHs. This makes it effective again. (decompose_rpath): Remove second parameter, callers changed. (fillin_rpath): Allocate enough space in curwd. (expand_dynamic_string_token): Cope with get_origin returning -1. 1998-09-14 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * libc-work/nis/nss_compat/compat-pwd.c: Add support for passwd.adjunct. * nis/nss_nis/nis-pwd.c (_nss_nis_getpwent_r): Correct test for invalid password. 1998-09-13 18:06 Ulrich Drepper <drepper@cygnus.com> * locale/programs/locale.c: Update dates.
-rw-r--r--ChangeLog95
-rw-r--r--Makefile1
-rw-r--r--Makerules6
-rw-r--r--Rules44
-rw-r--r--argp/argp-help.c7
-rw-r--r--elf/Makefile10
-rw-r--r--elf/dl-load.c159
-rw-r--r--elf/dl-support.c4
-rw-r--r--elf/rtld.c10
-rw-r--r--iconvdata/iso-2022-jp.c1
-rw-r--r--iconvdata/iso646.c1
-rw-r--r--include/stdlib.h9
-rw-r--r--locale/programs/locale.c4
-rw-r--r--nis/nss_compat/compat-pwd.c93
-rw-r--r--nis/nss_nis/nis-pwd.c2
-rw-r--r--nis/nss_nisplus/nisplus-service.c2
-rw-r--r--nss/nss_files/files-alias.c10
-rw-r--r--resolv/nss_dns/dns-network.c28
-rw-r--r--resolv/res_send.c4
-rw-r--r--rt/aio_cancel.c36
-rw-r--r--rt/aio_misc.c12
-rw-r--r--stdio-common/Makefile3
-rw-r--r--stdio-common/stdio_lim.h.in (renamed from sysdeps/generic/bits/stdio_lim.h)23
-rw-r--r--stdlib/stdlib.h25
-rw-r--r--string/bits/string2.h32
-rw-r--r--sunrpc/rpc_cout.c175
-rw-r--r--sysdeps/libm-ieee754/w_pow.c5
-rw-r--r--sysdeps/libm-ieee754/w_powf.c5
-rw-r--r--sysdeps/libm-ieee754/w_powl.c5
-rw-r--r--sysdeps/posix/Makefile37
-rw-r--r--sysdeps/posix/mk-stdiolim.c106
-rw-r--r--sysdeps/unix/sysv/linux/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile27
-rw-r--r--sysdeps/unix/sysv/linux/stdio_lim.h.in43
-rw-r--r--timezone/tst-timezone.c4
-rw-r--r--wcsmbs/wcsmbs-tst1.c1
36 files changed, 500 insertions, 530 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e34716a1a..00d0704af6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,98 @@
+1998-09-14 11:26 Ulrich Drepper <drepper@cygnus.com>
+
+ * wcsmbs/wcsmbs-tst1.c: Include stdlib.h.
+
+1998-09-14 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ * libc-work/nis/nss_nisplus/nisplus-service.c
+ (_nss_nisplus_parse_servent): Convert port in network byte order.
+
+1998-09-14 07:53 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * stdlib/stdlib.h: Add a switch, __need_malloc_and_calloc,
+ to provide only malloc and calloc.
+ * include/stdlib.h: Support the above.
+ * string/bits/string2.h: Use __need_malloc_and_calloc when
+ including stdlib.h.
+ (__string2_1bptr_p): Avoid -Wbad-function-cast warnings.
+
+ * iconvdata/iso-2022-jp.c: Include <stdlib.h>.
+ * iconvdata/iso646.c: Include <stdlib.h>.
+
+1998-09-14 07:51 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * sunrpc/rpc_cout.c: Add braces around ambiguous else.
+ * sysdeps/libm-ieee754/w_pow.c: Likewise.
+ * sysdeps/libm-ieee754/w_powf.c: Likewise.
+ * sysdeps/libm-ieee754/w_powl.c: Likewise.
+
+1998-09-14 07:57 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * stdio-common/stdio_lim.h.in: New file. All parameters
+ are adjustable at build time.
+ * Rules: Add a rule to build bits/stdio_lim.h from
+ stdio-common/stdio_lim.h.in. (It has to be in Rules so that
+ all subdirectories know how to make the file. It can't be
+ in Makerules because then it gets built at top level and the
+ dependencies are wrong.)
+
+ * stdio-common/Makefile (distribute): Add stdio_lim.h.in.
+ * sysdeps/unix/sysv/linux/Makefile: Delete rules to make
+ stdio_lim.h.
+ * sysdeps/unix/sysv/linux/stdio_lim.h.in: Removed.
+ * sysdeps/unix/sysv/linux/Dist: Take out stdio_lim.h.in.
+ * sysdeps/posix/Makefile: Removed.
+ * sysdeps/posix/mk-stdiolim.c: Removed.
+ * sysdeps/generic/bits/stdio_lim.h: Removed.
+
+1998-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * argp/argp-help.c: Fixup indentation.
+ * nss/nss_files/files-alias.c: Quiet -Wparentheses warning.
+ * resolv/nss_dns/dns-network.c: Likewise.
+ * resolv/res_send.c: Likewise.
+ * rt/aio_cancel.c: Likewise.
+ * rt/aio_misc.c: Likewise.
+
+1998-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Makefile (install-symbolic-link): Remove the link list file at last.
+ * Makerules (install-clean-symbolic-link-list): Removed.
+
+1998-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * timezone/tst-timezone.c: Print time in UTC to get consistent
+ output.
+
+1998-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * elf/rtld.c (_dl_rpath): Removed.
+ * elf/dl-support.c (_dl_path): Removed.
+ * elf/Makefile ($(objpfx)ld.so): Don't pass -rpath.
+ (CFLAGS-dl-support.c): Removed.
+
+ * elf/dl-load.c (env_path_list): Renamed from fake_path_list. All
+ uses changed.
+ (_dl_init_paths): Always set env_path_list from LD_LIBRARY_PATH,
+ instead of appending it to the main map's rpath info.
+ (_dl_map_object): Consistently use LD_LIBRARY_PATH after all
+ DT_RPATHs. This makes it effective again.
+ (decompose_rpath): Remove second parameter, callers changed.
+ (fillin_rpath): Allocate enough space in curwd.
+ (expand_dynamic_string_token): Cope with get_origin returning -1.
+
+1998-09-14 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ * libc-work/nis/nss_compat/compat-pwd.c: Add support for
+ passwd.adjunct.
+
+ * nis/nss_nis/nis-pwd.c (_nss_nis_getpwent_r): Correct test for
+ invalid password.
+
+1998-09-13 18:06 Ulrich Drepper <drepper@cygnus.com>
+
+ * locale/programs/locale.c: Update dates.
+
1998-09-13 Mark Kettenis <kettenis@phys.uva.nl>
* sysdeps/generic/bits/types.h: Include <features.h>. Make sure
diff --git a/Makefile b/Makefile
index 45c905820e..21ae9d508a 100644
--- a/Makefile
+++ b/Makefile
@@ -101,6 +101,7 @@ install: install-symbolic-link
.PHONY: install-symbolic-link
install-symbolic-link: subdir_install
$(symbolic-link-prog) $(symbolic-link-list)
+ rm -f $(symbolic-link-list)
install:
-test ! -x $(common-objpfx)elf/ldconfig || \
diff --git a/Makerules b/Makerules
index c17ea781b9..2e724fabd5 100644
--- a/Makerules
+++ b/Makerules
@@ -651,14 +651,8 @@ endif
ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
-# We need to clean the symbolic link list first.
symbolic-link-prog := $(common-objpfx)elf/sln
symbolic-link-list := $(common-objpfx)elf/symlink.list
-install: install-clean-symbolic-link-list
-.PHONY: install-clean-symbolic-link-list
-install-clean-symbolic-link-list:
- rm -f $(symbolic-link-list)
-
define make-shlib-link
echo $(<F) $@ >> $(symbolic-link-list)
endef
diff --git a/Rules b/Rules
index b401c3136c..9c61b8418a 100644
--- a/Rules
+++ b/Rules
@@ -200,3 +200,47 @@ $(common-objpfx)dummy$o: $(common-objpfx)dummy.c $(before-compile);
endef
object-suffixes-left := $(object-suffixes)
include $(o-iterator)
+
+# There's no good place to put this - here will do.
+# The dependencies are wrong if it's run from the top level.
+ifeq ($(filter %posix, $(sysdirs)),)
+L_tmpnam = 1
+TMP_MAX = 0
+L_ctermid = 1
+L_cuserid = 1
+else
+L_tmpnam = 19
+TMP_MAX = 238328
+L_ctermid = 9
+L_cuserid = 9
+endif
+
+$(common-objpfx)bits/stdio_%.h $(common-objpfx)bits/stdio_%.d: \
+ $(..)stdio-common/stdio_%.h.in
+ $(make-target-directory)
+ echo '#include "$(..)posix/bits/posix1_lim.h"' | \
+ SUNPRO_DEPENDENCIES='$(@:.h=.d)T MARKER' \
+ $(CC) $(+includes) -E -dM -xc - -o $(@:.d=.h)T
+ sed -e 's!MARKER!$(@:.h=.d) $(@:.d=.h)!' \
+ -e 's!$(common-objpfx)!$$(common-objpfx)!g' \
+ $(@:.h=.d)T > $(@:.h=.d)t && \
+ mv -f $(@:.h=.d)t $(@:.h=.d)
+ fopen_max=`sed -n 's/^#define OPEN_MAX //p' $(@:.d=.h)T`; \
+ filename_max=`sed -n 's/^#define PATH_MAX //p' $(@:.d=.h)T`; \
+ fopen_max=$${fopen_max:-16}; \
+ filename_max=$${filename_max:-1024}; \
+ sed -e "s/@FOPEN_MAX@/$$fopen_max/" \
+ -e "s/@FILENAME_MAX@/$$filename_max/" \
+ -e "s/@L_tmpnam@/$(L_tmpnam)/" \
+ -e "s/@TMP_MAX@/$(TMP_MAX)/" \
+ -e "s/@L_ctermid@/$(L_ctermid)/" \
+ -e "s/@L_cuserid@/$(L_cuserid)/" \
+ $< > $(@:.d=.h).new && \
+ mv -f $(@:.d=.h).new $(@:.d=.h); \
+# Remove these last so that they can be examined if something went wrong.
+ rm -f $(@:.d=.h)T $(@:.h=.d)T
+# Get dependencies.
+ifndef no_deps
+-include $(common-objpfx)bits/stdio_lim.d
+endif
+common-generated += bits/stdio_lim.h bits/stdio_lim.d
diff --git a/argp/argp-help.c b/argp/argp-help.c
index 9a1c05387f..a3a1a12ef9 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -833,11 +833,12 @@ hol_append (struct hol *hol, struct hol *more)
__mempcpy (short_options, hol->short_options, hol_so_len);
- /* Fix up the short options pointers from HOL. */
+ /* Fix up the short options pointers from HOL. */
for (e = entries, left = hol->num_entries; left > 0; e++, left--)
e->short_options += (short_options - hol->short_options);
- /* Now add the short options from MORE, fixing up its entries too. */
+ /* Now add the short options from MORE, fixing up its entries
+ too. */
so = short_options + hol_so_len;
more_so = more->short_options;
for (left = more->num_entries; left > 0; e++, left--)
@@ -872,7 +873,7 @@ hol_append (struct hol *hol, struct hol *more)
hol->num_entries = num_entries;
hol->short_options = short_options;
}
- }
+ }
hol_free (more);
}
diff --git a/elf/Makefile b/elf/Makefile
index 7f2201dc0a..ddd9d222fb 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -116,13 +116,9 @@ endif
$(objpfx)ld.so: $(objpfx)librtld.os $(addprefix $(objpfx),$(rtld-ldscript)) \
$(ld-map)
- $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
- -Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \
- $(filter-out $(rtld-ldscript) $(map-file),$^) \
- $(load-map-file) -Wl,-soname=$(rtld-installed-name)
-
-# The dl code in the static libc needs a default library path.
-CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"'
+ $(LINK.o) -nostdlib -nostartfiles -shared -o $@ $(LDFLAGS-rtld) \
+ $(filter-out $(rtld-ldscript) $(map-file),$^) \
+ $(load-map-file) -Wl,-soname=$(rtld-installed-name)
# interp.c exists just to get this string into the libraries.
CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"'
diff --git a/elf/dl-load.c b/elf/dl-load.c
index b93258e9eb..cb0a4ff753 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -99,9 +99,8 @@ size_t _dl_pagesize;
extern const char *_dl_platform;
extern size_t _dl_platformlen;
-/* This is a fake list to store the RPATH information for static
- binaries. */
-static struct r_search_path_elem **fake_path_list;
+/* This is the decomposed LD_LIBRARY_PATH search path. */
+static struct r_search_path_elem **env_path_list;
/* List of the hardware capabilities we might end up using. */
static const struct r_strlenpair *capstr;
@@ -175,7 +174,8 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
{
assert (l->l_name[0] == '\0');
l->l_origin = get_origin ();
- origin_len = l->l_origin ? strlen (l->l_origin) : 0;
+ origin_len = (l->l_origin && l->l_origin != (char *) -1
+ ? strlen (l->l_origin) : 0);
}
else
origin_len = l->l_origin == (char *) -1 ? 0 : strlen (l->l_origin);
@@ -293,8 +293,8 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
interpreted as `use the current directory'. */
if (len == 0)
{
- static char curwd[2];
- cp = strcpy (curwd, ".");
+ static char curwd[] = "./";
+ cp = curwd;
}
/* Remove trailing slashes (except for "/"). */
@@ -388,7 +388,7 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
static struct r_search_path_elem **
internal_function
-decompose_rpath (const char *rpath, size_t additional_room, struct link_map *l)
+decompose_rpath (const char *rpath, struct link_map *l)
{
/* Make a copy we can work with. */
const char *where = l->l_name;
@@ -410,7 +410,7 @@ decompose_rpath (const char *rpath, size_t additional_room, struct link_map *l)
/* This object is on the list of objects for which the RPATH
must not be used. */
result = (struct r_search_path_elem **)
- malloc ((additional_room + 1) * sizeof (*result));
+ malloc (sizeof (*result));
if (result == NULL)
_dl_signal_error (ENOMEM, NULL,
"cannot create cache for search path");
@@ -433,10 +433,9 @@ decompose_rpath (const char *rpath, size_t additional_room, struct link_map *l)
if (*cp == ':')
++nelems;
- /* Allocate room for the result. NELEMS + 1 + ADDITIONAL_ROOM is an upper
- limit for the number of necessary entries. */
- result = (struct r_search_path_elem **) malloc ((nelems + 1
- + additional_room + 1)
+ /* Allocate room for the result. NELEMS + 1 is an upper limit for the
+ number of necessary entries. */
+ result = (struct r_search_path_elem **) malloc ((nelems + 1 + 1)
* sizeof (*result));
if (result == NULL)
_dl_signal_error (ENOMEM, NULL, "cannot create cache for search path");
@@ -458,32 +457,9 @@ _dl_init_paths (const char *llp)
struct r_search_path_elem *pelem, **aelem;
size_t round_size;
-#ifdef PIC
- /* We have in `search_path' the information about the RPATH of the
- dynamic loader. Now fill in the information about the applications
- RPATH and the directories addressed by the LD_LIBRARY_PATH environment
- variable. */
+ /* Fill in the information about the application's RPATH and the
+ directories addressed by the LD_LIBRARY_PATH environment variable. */
struct link_map *l;
-#endif
-
- /* Number of elements in the library path. */
- size_t nllp;
-
- /* First determine how many elements the LD_LIBRARY_PATH contents has. */
- if (llp != NULL && *llp != '\0')
- {
- /* Simply count the number of colons. */
- const char *cp = llp;
- nllp = 1;
- while (*cp)
- {
- if (*cp == ':' || *cp == ';')
- ++nllp;
- ++cp;
- }
- }
- else
- nllp = 0;
/* Get the capabilities. */
capstr = _dl_important_hwcaps (_dl_platform, _dl_platformlen,
@@ -533,81 +509,44 @@ _dl_init_paths (const char *llp)
l = _dl_loaded;
if (l != NULL)
{
- /* We should never get here when initializing in a static application.
- If this is a dynamically linked application _dl_loaded always
- points to the main map which is not dlopen()ed. */
assert (l->l_type != lt_loaded);
if (l->l_info[DT_RPATH])
- {
- /* Allocate room for the search path and fill in information
- from RPATH. */
- l->l_rpath_dirs =
- decompose_rpath ((const char *)
- (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr
- + l->l_info[DT_RPATH]->d_un.d_val),
- nllp, l);
- }
+ /* Allocate room for the search path and fill in information
+ from RPATH. */
+ l->l_rpath_dirs =
+ decompose_rpath ((const char *)
+ (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr
+ + l->l_info[DT_RPATH]->d_un.d_val), l);
else
- {
- /* If we have no LD_LIBRARY_PATH and no RPATH we must tell
- this somehow to prevent we look this up again and again. */
- if (nllp == 0)
- l->l_rpath_dirs = (struct r_search_path_elem **) -1l;
- else
- {
- l->l_rpath_dirs = (struct r_search_path_elem **)
- malloc ((nllp + 1) * sizeof (*l->l_rpath_dirs));
- if (l->l_rpath_dirs == NULL)
- _dl_signal_error (ENOMEM, NULL,
- "cannot create cache for search path");
- l->l_rpath_dirs[0] = NULL;
- }
- }
-
- /* We don't need to search the list of fake entries which is searched
- when no dynamic objects were loaded at this time. */
- fake_path_list = NULL;
-
- if (nllp > 0)
- {
- char *copy = local_strdup (llp);
-
- /* Decompose the LD_LIBRARY_PATH and fill in the result.
- First search for the next place to enter elements. */
- struct r_search_path_elem **result = l->l_rpath_dirs;
- while (*result != NULL)
- ++result;
-
- /* We need to take care that the LD_LIBRARY_PATH environment
- variable can contain a semicolon. */
- (void) fillin_rpath (copy, result, ":;",
- __libc_enable_secure ? system_dirs : NULL,
- "LD_LIBRARY_PATH", NULL);
- }
+ l->l_rpath_dirs = NULL;
}
- else
#endif /* PIC */
+
+ if (llp != NULL && *llp != '\0')
{
- /* This is a statically linked program but we still have to take
- care for the LD_LIBRARY_PATH environment variable. We use a fake
- link_map entry. This will only contain the l_rpath_dirs
- information. */
+ size_t nllp;
+ const char *cp = llp;
- if (nllp == 0)
- fake_path_list = NULL;
- else
+ /* Decompose the LD_LIBRARY_PATH contents. First determine how many
+ elements it has. */
+ nllp = 1;
+ while (*cp)
{
- fake_path_list = (struct r_search_path_elem **)
- malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));
- if (fake_path_list == NULL)
- _dl_signal_error (ENOMEM, NULL,
- "cannot create cache for search path");
-
- (void) fillin_rpath (local_strdup (llp), fake_path_list, ":;",
- __libc_enable_secure ? system_dirs : NULL,
- "LD_LIBRARY_PATH", NULL);
+ if (*cp == ':' || *cp == ';')
+ ++nllp;
+ ++cp;
}
+
+ env_path_list = (struct r_search_path_elem **)
+ malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));
+ if (env_path_list == NULL)
+ _dl_signal_error (ENOMEM, NULL,
+ "cannot create cache for search path");
+
+ (void) fillin_rpath (local_strdup (llp), env_path_list, ":;",
+ __libc_enable_secure ? system_dirs : NULL,
+ "LD_LIBRARY_PATH", NULL);
}
}
@@ -1243,25 +1182,23 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
+ l->l_info[DT_STRTAB]->d_un.d_ptr
+ l->l_info[DT_RPATH]->d_un.d_val);
l->l_rpath_dirs =
- decompose_rpath ((const char *) ptrval, 0, l);
+ decompose_rpath ((const char *) ptrval, l);
}
- if (l->l_rpath_dirs != (struct r_search_path_elem **) -1l)
+ if (l->l_rpath_dirs != NULL)
fd = open_path (name, namelen, preloaded, l->l_rpath_dirs,
&realname);
}
- /* If dynamically linked, try the DT_RPATH of the executable itself
- and the LD_LIBRARY_PATH environment variable. */
+ /* If dynamically linked, try the DT_RPATH of the executable itself. */
l = _dl_loaded;
if (fd == -1 && l && l->l_type != lt_loaded && l != loader
- && l->l_rpath_dirs != (struct r_search_path_elem **) -1l)
+ && l->l_rpath_dirs != NULL)
fd = open_path (name, namelen, preloaded, l->l_rpath_dirs, &realname);
- /* This is used if a static binary uses dynamic loading and there
- is a LD_LIBRARY_PATH given. */
- if (fd == -1 && fake_path_list != NULL)
- fd = open_path (name, namelen, preloaded, fake_path_list, &realname);
+ /* Try the LD_LIBRARY_PATH environment variable. */
+ if (fd == -1 && env_path_list != NULL)
+ fd = open_path (name, namelen, preloaded, env_path_list, &realname);
if (fd == -1)
{
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 76af1883ac..1126d46771 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -29,10 +29,6 @@
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
-/* This defines the default search path for libraries.
- For the dynamic linker it is set by -rpath when linking. */
-const char *_dl_rpath = DEFAULT_RPATH;
-
/* Name of the architecture. */
const char *_dl_platform;
size_t _dl_platformlen;
diff --git a/elf/rtld.c b/elf/rtld.c
index 7216c19aab..7c2e054d88 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -69,7 +69,6 @@ static void process_envvars (enum mode *modep, int *lazyp);
int _dl_argc;
char **_dl_argv;
unsigned int _dl_skip_args; /* Nonzero if we were run directly. */
-const char *_dl_rpath;
int _dl_verbose;
const char *_dl_platform;
size_t _dl_platformlen;
@@ -164,15 +163,6 @@ _dl_start (void *arg)
sizeof _dl_rtld_map.l_info);
_dl_setup_hash (&_dl_rtld_map);
- /* Cache the DT_RPATH stored in ld.so itself; this will be
- the default search path. */
- if (_dl_rtld_map.l_info[DT_STRTAB] && _dl_rtld_map.l_info[DT_RPATH])
- {
- _dl_rpath = (void *) (_dl_rtld_map.l_addr +
- _dl_rtld_map.l_info[DT_STRTAB]->d_un.d_ptr +
- _dl_rtld_map.l_info[DT_RPATH]->d_un.d_val);
- }
-
/* Don't bother trying to work out how ld.so is mapped in memory. */
_dl_rtld_map.l_map_start = ~0;
_dl_rtld_map.l_map_end = ~0;
diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c
index 387298803f..9aeaad6c3e 100644
--- a/iconvdata/iso-2022-jp.c
+++ b/iconvdata/iso-2022-jp.c
@@ -20,6 +20,7 @@
#include <gconv.h>
#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
#include "jis0201.h"
#include "jis0208.h"
diff --git a/iconvdata/iso646.c b/iconvdata/iso646.c
index af1479a347..9888208122 100644
--- a/iconvdata/iso646.c
+++ b/iconvdata/iso646.c
@@ -33,6 +33,7 @@
#include <gconv.h>
#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
/* Definitions used in the body of the `gconv' function. */
diff --git a/include/stdlib.h b/include/stdlib.h
index 7424243e99..c15d364c6e 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,7 +1,13 @@
#ifndef _STDLIB_H
+
+#ifdef __need_malloc_and_calloc
+#define __Need_M_And_C
+#endif
+
#include <stdlib/stdlib.h>
/* Now define the internal interfaces. */
+#ifndef __Need_M_And_C
extern int32_t __random __P ((void));
extern void __srandom __P ((unsigned int __seed));
extern __ptr_t __initstate __P ((unsigned int __seed, __ptr_t __statebuf,
@@ -41,3 +47,6 @@ extern char *__realpath __P ((__const char *__name, char *__resolved));
extern int __ptsname_r __P ((int __fd, char *__buf, size_t __buflen));
extern int __getpt __P ((void));
#endif
+#undef __Need_M_And_C
+
+#endif /* include/stdlib.h */
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 93818e02e2..c51c0a14fa 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -1,5 +1,5 @@
/* Implementation of the locale program according to POSIX 9945-2.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -268,7 +268,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "1995, 1996, 1997");
+"), "1995, 1996, 1997, 1998");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index 4cbf739d05..f4e0720fb9 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -186,6 +186,62 @@ copy_pwd_changes (struct passwd *dest, struct passwd *src,
}
static enum nss_status
+insert_passwd_adjunct (char **result, int *len, char *domain, int *errnop)
+{
+ char *p1, *p2, *result2, *res;
+ int len2;
+ size_t namelen;
+
+ /* Check for adjunct style secret passwords. They can be
+ recognized by a password starting with "##". */
+ p1 = strchr (*result, ':');
+ if (p1 == NULL || p1[1] != '#' || p1[2] != '#')
+ return NSS_STATUS_SUCCESS;
+ p2 = strchr (p1 + 3, ':');
+
+ namelen = p2 - p1 - 3;
+
+ if (yp_match (domain, "passwd.adjunct.byname", &p1[3], namelen,
+ &result2, &len2) == YPERR_SUCCESS)
+ {
+ /* We found a passwd.adjunct entry. Merge encrypted
+ password therein into original result. */
+ char *encrypted = strchr (result2, ':');
+ char *endp;
+ size_t restlen;
+
+ if (encrypted == NULL || (endp = strchr (++encrypted, ':')) == NULL)
+ {
+ /* Invalid format of the entry. This never should happen
+ unless the data from which the NIS table is generated is
+ wrong. We simply ignore it. */
+ free (result2);
+ return NSS_STATUS_SUCCESS;
+ }
+
+ restlen = *len - (p2 - *result);
+ if ((res = malloc (namelen + restlen + (endp - encrypted) + 2)) == NULL)
+ {
+ free (result2);
+ *errnop = ENOMEM;
+ return NSS_STATUS_TRYAGAIN;
+ }
+
+ __mempcpy (__mempcpy (__mempcpy (__mempcpy
+ (res, *result, (p1 - *result)),
+ ":", 1),
+ encrypted, endp - encrypted),
+ p2, restlen + 1);
+
+ free (result2);
+ free (*result);
+ *result = res;
+ *len = strlen (res);
+ }
+ return NSS_STATUS_SUCCESS;
+}
+
+static enum nss_status
internal_setpwent (ent_t *ent)
{
enum nss_status status = NSS_STATUS_SUCCESS;
@@ -403,6 +459,13 @@ getpwent_next_nis_netgr (const char *name, struct passwd *result, ent_t *ent,
!= YPERR_SUCCESS)
continue;
+ if (insert_passwd_adjunct (&outval, &outvallen, ypdomain, errnop)
+ != NSS_STATUS_SUCCESS)
+ {
+ free (outval);
+ return NSS_STATUS_TRYAGAIN;
+ }
+
p2len = pwd_need_buflen (&ent->pwd);
if (p2len > buflen)
{
@@ -659,6 +722,13 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
return NSS_STATUS_UNAVAIL;
}
+ if (insert_passwd_adjunct (&outval, &outvallen, domain, errnop) !=
+ NSS_STATUS_SUCCESS)
+ {
+ free (outval);
+ return NSS_STATUS_TRYAGAIN;
+ }
+
if (buflen < ((size_t) outvallen + 1))
{
free (outval);
@@ -685,6 +755,13 @@ getpwent_next_nis (struct passwd *result, ent_t *ent, char *buffer,
return NSS_STATUS_NOTFOUND;
}
+ if (insert_passwd_adjunct (&outval, &outvallen, domain, errnop)
+ != NSS_STATUS_SUCCESS)
+ {
+ free (outval);
+ return NSS_STATUS_TRYAGAIN;
+ }
+
if (buflen < ((size_t) outvallen + 1))
{
free (outval);
@@ -796,6 +873,13 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
return NSS_STATUS_NOTFOUND;
}
+ if (insert_passwd_adjunct (&outval, &outvallen, domain, errnop)
+ != NSS_STATUS_SUCCESS)
+ {
+ free (outval);
+ return NSS_STATUS_TRYAGAIN;
+ }
+
if (buflen < ((size_t) outvallen + 1))
{
free (outval);
@@ -1307,7 +1391,14 @@ getpwuid_plususer (uid_t uid, struct passwd *result, char *buffer,
return NSS_STATUS_TRYAGAIN;
}
- if ( buflen < ((size_t) outvallen + 1))
+ if (insert_passwd_adjunct (&outval, &outvallen, domain, errnop)
+ != NSS_STATUS_SUCCESS)
+ {
+ free (outval);
+ return NSS_STATUS_TRYAGAIN;
+ }
+
+ if (buflen < ((size_t) outvallen + 1))
{
free (outval);
*errnop = ERANGE;
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index c0acaa13e5..0a337bb9e7 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -128,7 +128,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
char *endp;
size_t restlen;
- if (encrypted != NULL
+ if (encrypted == NULL
|| (endp = strchr (++encrypted, ':')) == NULL
|| (p = strchr (p + 1, ':')) == NULL)
{
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index 04fed59808..6dfae5e2ef 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -80,7 +80,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
room_left -= strlen (first_unused) + 1;
first_unused += strlen (first_unused) + 1;
- serv->s_port = atoi (NISENTRYVAL (0, 3, result));
+ serv->s_port = htons (atoi (NISENTRYVAL (0, 3, result)));
p = first_unused;
line = p;
diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
index 2d6e15c1d8..b18361f66c 100644
--- a/nss/nss_files/files-alias.c
+++ b/nss/nss_files/files-alias.c
@@ -382,10 +382,12 @@ _nss_files_getaliasent_r (struct aliasent *result, char *buffer, size_t buflen,
/* If the last use was not by the getent function we need the
position the stream. */
if (last_use != getent)
- if (fsetpos (stream, &position) < 0)
- status = NSS_STATUS_UNAVAIL;
- else
- last_use = getent;
+ {
+ if (fsetpos (stream, &position) < 0)
+ status = NSS_STATUS_UNAVAIL;
+ else
+ last_use = getent;
+ }
if (status == NSS_STATUS_SUCCESS)
{
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 61f6f90b47..e9a4b91e9d 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -231,19 +231,21 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
char *ans;
if (question_count == 0)
- /* FIXME: the Sun version uses for host name lookup an additional
- parameter for pointing to h_errno. this is missing here.
- OSF/1 has a per-thread h_errno variable. */
- if (header_pointer->aa != 0)
- {
- __set_h_errno (HOST_NOT_FOUND);
- return NSS_STATUS_NOTFOUND;
- }
- else
- {
- __set_h_errno (TRY_AGAIN);
- return NSS_STATUS_TRYAGAIN;
- }
+ {
+ /* FIXME: the Sun version uses for host name lookup an additional
+ parameter for pointing to h_errno. this is missing here.
+ OSF/1 has a per-thread h_errno variable. */
+ if (header_pointer->aa != 0)
+ {
+ __set_h_errno (HOST_NOT_FOUND);
+ return NSS_STATUS_NOTFOUND;
+ }
+ else
+ {
+ __set_h_errno (TRY_AGAIN);
+ return NSS_STATUS_TRYAGAIN;
+ }
+ }
/* Skip the question part. */
while (question_count-- > 0)
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 0c784688ac..608659b2ca 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -782,12 +782,12 @@ read_len:
} /*foreach ns*/
} /*foreach retry*/
res_close();
- if (!v_circuit)
+ if (!v_circuit) {
if (!gotsomewhere)
__set_errno (ECONNREFUSED); /* no nameservers found */
else
__set_errno (ETIMEDOUT); /* no answer obtained */
- else
+ } else
__set_errno (terrno);
return (-1);
}
diff --git a/rt/aio_cancel.c b/rt/aio_cancel.c
index 645ae16d04..8a23353b14 100644
--- a/rt/aio_cancel.c
+++ b/rt/aio_cancel.c
@@ -106,24 +106,26 @@ aio_cancel (fildes, aiocbp)
/* If any request is worked on by a thread it must be the first.
So either we can delete all requests or all but the first. */
if (req != NULL)
- if (req->running == allocated)
- {
- struct requestlist *old = req;
- req = req->next_prio;
- old->next_prio = NULL;
+ {
+ if (req->running == allocated)
+ {
+ struct requestlist *old = req;
+ req = req->next_prio;
+ old->next_prio = NULL;
- result = AIO_NOTCANCELED;
- }
- else
- {
- /* Remove entry from the file descriptor list. */
- if (req->last_fd != NULL)
- req->last_fd->next_fd = req->next_fd;
- if (req->next_fd != NULL)
- req->next_fd->last_fd = req->last_fd;
-
- result = AIO_CANCELED;
- }
+ result = AIO_NOTCANCELED;
+ }
+ else
+ {
+ /* Remove entry from the file descriptor list. */
+ if (req->last_fd != NULL)
+ req->last_fd->next_fd = req->next_fd;
+ if (req->next_fd != NULL)
+ req->next_fd->last_fd = req->last_fd;
+
+ result = AIO_CANCELED;
+ }
+ }
}
/* Mark requests as canceled and send signal. */
diff --git a/rt/aio_misc.c b/rt/aio_misc.c
index 0148705662..1688a15432 100644
--- a/rt/aio_misc.c
+++ b/rt/aio_misc.c
@@ -162,11 +162,13 @@ __aio_find_req (aiocb_union *elem)
runp = runp->next_fd;
if (runp != NULL)
- if (runp->aiocbp->aiocb.aio_fildes != fildes)
- runp = NULL;
- else
- while (runp != NULL && runp->aiocbp != elem)
- runp = runp->next_prio;
+ {
+ if (runp->aiocbp->aiocb.aio_fildes != fildes)
+ runp = NULL;
+ else
+ while (runp != NULL && runp->aiocbp != elem)
+ runp = runp->next_prio;
+ }
return runp;
}
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index dba0335a4b..183f140661 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -37,7 +37,7 @@ routines := \
lockfile
aux := errlist siglist
-distribute := _itoa.h printf-parse.h
+distribute := _itoa.h printf-parse.h stdio_lim.h.in
tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
@@ -46,7 +46,6 @@ tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
tfformat tiformat tstdiomisc tst-printfsz tst-wc-printf \
scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10
-
include ../Rules
CFLAGS-vfprintf.c = -Wno-uninitialized
diff --git a/sysdeps/generic/bits/stdio_lim.h b/stdio-common/stdio_lim.h.in
index 86e83cf1e2..957fac6449 100644
--- a/sysdeps/generic/bits/stdio_lim.h
+++ b/stdio-common/stdio_lim.h.in
@@ -1,5 +1,4 @@
-/* Stdio limits for non-POSIX systems.
- Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 1998 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,20 +20,18 @@
# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
#endif
-#ifndef __need_FOPEN_MAX
-# define L_tmpnam 1
-# define TMP_MAX 0
+#ifdef _STDIO_H
+# define L_tmpnam @L_tmpnam@
+# define TMP_MAX @TMP_MAX@
+# define FILENAME_MAX @FILENAME_MAX@
# ifdef __USE_POSIX
-# define L_ctermid 1
-# define L_cuserid 1
+# define L_ctermid @L_ctermid@
+# define L_cuserid @L_cuserid@
# endif
-
-# define FILENAME_MAX 14
#endif
-#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX
-# define __defined_FOPEN_MAX
-# define FOPEN_MAX 16
+#if defined __need_FOPEN_MAX || defined _STDIO_H
+# undef FOPEN_MAX
+# define FOPEN_MAX @FOPEN_MAX@
#endif
-#undef __need_FOPEN_MAX
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 49374bd396..e577fb7245 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -21,18 +21,22 @@
*/
#ifndef _STDLIB_H
-#define _STDLIB_H 1
#include <features.h>
/* Get size_t, wchar_t and NULL from <stddef.h>. */
-#define __need_size_t
-#define __need_wchar_t
-#define __need_NULL
+#define __need_size_t
+#ifndef __need_malloc_and_calloc
+# define __need_wchar_t
+# define __need_NULL
+#endif
#include <stddef.h>
__BEGIN_DECLS
+#ifndef __need_malloc_and_calloc
+#define _STDLIB_H 1
+
/* Returned by `div'. */
typedef struct
{
@@ -440,14 +444,20 @@ extern int lcong48_r __P ((unsigned short int __param[7],
# endif /* Use misc. */
#endif /* Use SVID or X/Open. */
+#endif /* don't just need malloc and calloc */
+#ifndef __malloc_and_calloc_defined
+#define __malloc_and_calloc_defined
/* Allocate SIZE bytes of memory. */
extern __ptr_t malloc __P ((size_t __size));
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
+extern __ptr_t calloc __P ((size_t __nmemb, size_t __size));
+#endif
+
+#ifndef __need_malloc_and_calloc
/* Re-allocate the previously allocated block
in __ptr_t, making the new block SIZE bytes long. */
extern __ptr_t realloc __P ((__ptr_t __ptr, size_t __size));
-/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
-extern __ptr_t calloc __P ((size_t __nmemb, size_t __size));
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
extern void free __P ((__ptr_t __ptr));
@@ -720,6 +730,9 @@ extern int ptsname_r __P ((int __fd, char *__buf, size_t __buflen));
extern int getpt __P ((void));
#endif
+#endif /* don't just need malloc and calloc */
+#undef __need_malloc_and_calloc
+
__END_DECLS
#endif /* stdlib.h */
diff --git a/string/bits/string2.h b/string/bits/string2.h
index 0d378039fe..8051c48162 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -85,11 +85,12 @@ __STRING2_COPY_TYPE (8);
# undef __STRING2_COPY_TYPE
#endif
-/* Dereferencing a pointer arg to run sizeof on it fails for the
- void pointer case, so we use this instead. Note that the argument
- must not contain any side effects. */
-#define __string2_1bptr_p(x) (((size_t) ((x) + 1) - (size_t) (x)) == 1)
-
+/* Dereferencing a pointer arg to run sizeof on it fails for the void
+ pointer case, so we use this instead.
+ Note that __x is evaluated twice. */
+#define __string2_1bptr_p(__x) \
+ (({ const void *__a, *__b; __a = (__x) + 1; __b = (__x); \
+ (size_t)__a - (size_t)__b; }) == 1)
/* Set N bytes of S to C. */
#ifndef _HAVE_STRING_ARCH_memset
@@ -862,12 +863,17 @@ __strsep_g (char **__s, __const char *__reject)
# endif
#endif
+/* We need the memory allocation functions for inline strdup().
+ Referring to stdlib.h (even minimally) is not allowed if
+ __STRICT_ANSI__. */
+#ifndef __STRICT_ANSI__
-#if !defined _HAVE_STRING_ARCH_strdup && !defined __STRICT_ANSI__
-
-/* We need the memory allocation functions. Including this header is
- not allowed. */
+#if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup
+# define __need_malloc_and_calloc
# include <stdlib.h>
+#endif
+
+#ifndef _HAVE_STRING_ARCH_strdup
# define __strdup(s) \
(__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s) \
@@ -885,12 +891,7 @@ __strsep_g (char **__s, __const char *__reject)
# endif
#endif
-
-#if !defined _HAVE_STRING_ARCH_strndup && !defined __STRICT_ANSI__
-
-/* We need the memory allocation functions. Including this header is
- not allowed. */
-# include <stdlib.h>
+#ifndef _HAVE_STRING_ARCH_strndup
# define __strndup(s, n) \
(__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s) \
@@ -916,6 +917,7 @@ __strsep_g (char **__s, __const char *__reject)
# endif
#endif
+#endif /* Strict ANSI */
#undef __STRING_INLINE
diff --git a/sunrpc/rpc_cout.c b/sunrpc/rpc_cout.c
index a9da54e7f8..541be6e0da 100644
--- a/sunrpc/rpc_cout.c
+++ b/sunrpc/rpc_cout.c
@@ -453,8 +453,8 @@ inline_struct (definition *def, int flag)
if (flag == PUT)
f_print (fout, "\n\tif (xdrs->x_op == XDR_ENCODE) {\n");
else
- f_print(fout,
- "\t\treturn TRUE;\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
+ f_print (fout,
+ "\t\treturn TRUE;\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
i = 0;
size = 0;
@@ -506,49 +506,51 @@ inline_struct (definition *def, int flag)
else
{
if (i > 0)
- if (sizestr == NULL && size < inlineflag)
- {
- /* don't expand into inline code if size < inlineflag */
- while (cur != dl)
- {
- print_stat (indent + 1, &cur->decl);
- cur = cur->next;
- }
- }
- else
- {
- /* were already looking at a xdr_inlineable structure */
- tabify (fout, indent + 1);
- if (sizestr == NULL)
- f_print (fout, "buf = XDR_INLINE (xdrs, %d * BYTES_PER_XDR_UNIT);", size);
- else if (size == 0)
- f_print (fout,
- "buf = XDR_INLINE (xdrs, %s * BYTES_PER_XDR_UNIT);",
- sizestr);
- else
- f_print (fout,
- "buf = XDR_INLINE(xdrs, (%d + (%s)) * BYTES_PER_XDR_UNIT);",
- size, sizestr);
- f_print (fout, "\n");
- tabify (fout, indent + 1);
- fprintf (fout, "if (buf == NULL) {\n");
- psav = cur;
- while (cur != dl)
- {
- print_stat (indent + 2, &cur->decl);
- cur = cur->next;
- }
-
- f_print (fout, "\n\t\t} else {\n");
- cur = psav;
- while (cur != dl)
- {
- emit_inline (indent + 1, &cur->decl, flag);
- cur = cur->next;
- }
- tabify (fout, indent + 1);
- f_print (fout, "}\n");
- }
+ {
+ if (sizestr == NULL && size < inlineflag)
+ {
+ /* don't expand into inline code if size < inlineflag */
+ while (cur != dl)
+ {
+ print_stat (indent + 1, &cur->decl);
+ cur = cur->next;
+ }
+ }
+ else
+ {
+ /* were already looking at a xdr_inlineable structure */
+ tabify (fout, indent + 1);
+ if (sizestr == NULL)
+ f_print (fout, "buf = XDR_INLINE (xdrs, %d * BYTES_PER_XDR_UNIT);", size);
+ else if (size == 0)
+ f_print (fout,
+ "buf = XDR_INLINE (xdrs, %s * BYTES_PER_XDR_UNIT);",
+ sizestr);
+ else
+ f_print (fout,
+ "buf = XDR_INLINE(xdrs, (%d + (%s)) * BYTES_PER_XDR_UNIT);",
+ size, sizestr);
+ f_print (fout, "\n");
+ tabify (fout, indent + 1);
+ fprintf (fout, "if (buf == NULL) {\n");
+ psav = cur;
+ while (cur != dl)
+ {
+ print_stat (indent + 2, &cur->decl);
+ cur = cur->next;
+ }
+
+ f_print (fout, "\n\t\t} else {\n");
+ cur = psav;
+ while (cur != dl)
+ {
+ emit_inline (indent + 1, &cur->decl, flag);
+ cur = cur->next;
+ }
+ tabify (fout, indent + 1);
+ f_print (fout, "}\n");
+ }
+ }
size = 0;
i = 0;
sizestr = NULL;
@@ -556,46 +558,49 @@ inline_struct (definition *def, int flag)
}
}
if (i > 0)
- if (sizestr == NULL && size < inlineflag)
- {
- /* don't expand into inline code if size < inlineflag */
- while (cur != dl)
- {
- print_stat (indent + 1, &cur->decl);
- cur = cur->next;
- }
- }
- else
- {
- /* were already looking at a xdr_inlineable structure */
- if (sizestr == NULL)
- f_print (fout, "\t\tbuf = XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);",
- size);
- else if (size == 0)
- f_print (fout,
- "\t\tbuf = XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);",
- sizestr);
- else
- f_print (fout,
- "\t\tbuf = XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);",
- size, sizestr);
- f_print (fout, "\n\t\tif (buf == NULL) {\n");
- psav = cur;
- while (cur != NULL)
- {
- print_stat (indent + 2, &cur->decl);
- cur = cur->next;
- }
- f_print (fout, "\t\t} else {\n");
+ {
+ if (sizestr == NULL && size < inlineflag)
+ {
+ /* don't expand into inline code if size < inlineflag */
+ while (cur != dl)
+ {
+ print_stat (indent + 1, &cur->decl);
+ cur = cur->next;
+ }
+ }
+ else
+ {
+ /* were already looking at a xdr_inlineable structure */
+ if (sizestr == NULL)
+ f_print (fout,
+ "\t\tbuf = XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);",
+ size);
+ else if (size == 0)
+ f_print (fout,
+ "\t\tbuf = XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);",
+ sizestr);
+ else
+ f_print (fout,
+ "\t\tbuf = XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);",
+ size, sizestr);
+ f_print (fout, "\n\t\tif (buf == NULL) {\n");
+ psav = cur;
+ while (cur != NULL)
+ {
+ print_stat (indent + 2, &cur->decl);
+ cur = cur->next;
+ }
+ f_print (fout, "\t\t} else {\n");
- cur = psav;
- while (cur != dl)
- {
- emit_inline (indent + 2, &cur->decl, flag);
- cur = cur->next;
- }
- f_print (fout, "\t\t}\n");
- }
+ cur = psav;
+ while (cur != dl)
+ {
+ emit_inline (indent + 2, &cur->decl, flag);
+ cur = cur->next;
+ }
+ f_print (fout, "\t\t}\n");
+ }
+ }
}
/* this may be const. i haven't traced this one through yet. */
@@ -724,7 +729,7 @@ emit_inline (int indent, declaration * decl, int flag)
f_print (fout, "register %s *genp;\n\n", decl->type);
tabify (fout, indent + 1);
f_print (fout,
- "for (i = 0, genp = objp->%s;\n", decl->name);
+ "for (i = 0, genp = objp->%s;\n", decl->name);
tabify (fout, indent + 2);
f_print (fout, "i < %s; ++i) {\n", decl->array_max);
emit_single_in_line (indent + 2, decl, flag, REL_VECTOR);
diff --git a/sysdeps/libm-ieee754/w_pow.c b/sysdeps/libm-ieee754/w_pow.c
index 1711d71bda..5850651a1a 100644
--- a/sysdeps/libm-ieee754/w_pow.c
+++ b/sysdeps/libm-ieee754/w_pow.c
@@ -39,14 +39,15 @@
else
return z;
}
- if(x==0.0){
+ if(x==0.0) {
if(y==0.0)
return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
- if(__finite(y)&&y<0.0)
+ if(__finite(y)&&y<0.0) {
if (signbit (x) && signbit (z))
return __kernel_standard(x,y,23); /* pow(-0.0,negative) */
else
return __kernel_standard(x,y,43); /* pow(+0.0,negative) */
+ }
return z;
}
if(!__finite(z)) {
diff --git a/sysdeps/libm-ieee754/w_powf.c b/sysdeps/libm-ieee754/w_powf.c
index 0b20822be8..32196fd89f 100644
--- a/sysdeps/libm-ieee754/w_powf.c
+++ b/sysdeps/libm-ieee754/w_powf.c
@@ -45,16 +45,17 @@ static char rcsid[] = "$NetBSD: w_powf.c,v 1.3 1995/05/10 20:49:41 jtc Exp $";
else
return z;
}
- if(x==(float)0.0){
+ if(x==(float)0.0) {
if(y==(float)0.0)
/* powf(0.0,0.0) */
return (float)__kernel_standard((double)x,(double)y,120);
- if(__finitef(y)&&y<(float)0.0)
+ if(__finitef(y)&&y<(float)0.0) {
if (signbit (x) && signbit (z))
/* powf(0.0,negative) */
return (float)__kernel_standard((double)x,(double)y,123);
else
return (float)__kernel_standard((double)x,(double)y,143);
+ }
return z;
}
if(!__finitef(z)) {
diff --git a/sysdeps/libm-ieee754/w_powl.c b/sysdeps/libm-ieee754/w_powl.c
index 3529b5024c..17feb9fc61 100644
--- a/sysdeps/libm-ieee754/w_powl.c
+++ b/sysdeps/libm-ieee754/w_powl.c
@@ -41,14 +41,15 @@
else
return z;
}
- if(x==0.0){
+ if(x==0.0) {
if(y==0.0)
return __kernel_standard(x,y,220); /* pow(0.0,0.0) */
- if(__finitel(y)&&y<0.0)
+ if(__finitel(y)&&y<0.0) {
if (signbit (x) && signbit (z))
return __kernel_standard(x,y,223); /* pow(-0.0,negative) */
else
return __kernel_standard(x,y,243); /* pow(+0.0,negative) */
+ }
return z;
}
if(!__finitel(z)) {
diff --git a/sysdeps/posix/Makefile b/sysdeps/posix/Makefile
deleted file mode 100644
index 7806e4e86f..0000000000
--- a/sysdeps/posix/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
-# 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.
-
-ifneq (yes,$(inhibit-stdio_lim))
-# Disable these rules if we generate stdio_lim.h by other means.
-
-$(common-objpfx)bits/stdio_lim.h: $(common-objpfx)mk-stdiolim
- $(dir $<)$(notdir $<) > $@-t
- mv $@-t $@
-
-# Turn into a version that works when cd'd into $(objdir).
-mk-stdiolim-CFLAGS = $(patsubst -I$(shell pwd)//%,-I/%,\
- $(patsubst -I%,-I$(shell pwd)/%,$(+includes)))
-# $(ALL_BUILD_CFLAGS) needs to come last because it contains unwanted -Is.
-$(common-objpfx)mk-stdiolim: $(sysdep_dir)/posix/mk-stdiolim.c \
- $(..)posix/bits/posix1_lim.h bits/local_lim.h
- $(common-objdir-compile)
-
-common-generated := $(common-generated) bits/stdio_lim.h mk-stdiolim
-before-compile := $(before-compile) $(common-objpfx)bits/stdio_lim.h
-
-endif # inhibit-stdio_lim
diff --git a/sysdeps/posix/mk-stdiolim.c b/sysdeps/posix/mk-stdiolim.c
deleted file mode 100644
index ec482dee96..0000000000
--- a/sysdeps/posix/mk-stdiolim.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright (C) 1991, 1992, 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 <bits/posix1_lim.h>
-
-int
-main()
-{
- /* Print copyright message. */
- printf ("\
-/* Stdio limits for POSIX systems.\n\
- Copyright (C) 1994, 1997 Free Software Foundation, Inc.\n\
- This file is part of the GNU C Library.\n\
-\n\
- The GNU C Library is free software; you can redistribute it and/or\n\
- modify it under the terms of the GNU Library General Public License as\n\
- published by the Free Software Foundation; either version 2 of the\n\
- License, or (at your option) any later version.\n\
-\n\
- The GNU C Library is distributed in the hope that it will be useful,\n\
- but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\
- Library General Public License for more details.\n\
-\n\
- You should have received a copy of the GNU Library General Publicn\n\
- License along with the GNU C Library; see the file COPYING.LIB. If not,\n\
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n\
- Boston, MA 02111-1307, USA. */\n\
-\n\
-#if !defined _STDIO_H && !defined __need_FOPEN_MAX\n\
-# error \"Never include <bits/stdio_lim.h> directly; use <stdio.h> instead.\"\n\
-#endif\n\
-\n");
-
- /* These values correspond to the code in sysdeps/posix/tempname.c.
- Change the values here if you change that code. */
- puts ("#ifdef _STDIO_H");
- printf ("# define L_tmpnam %u\n", sizeof ("/usr/tmp/") + 9);
- printf ("# define TMP_MAX %u\n", 62 * 62 * 62);
-
- puts ("# ifdef __USE_POSIX");
- printf ("# define L_ctermid %u\n", sizeof ("/dev/tty"));
- printf ("# define L_cuserid 9\n");
- puts ("# endif");
-
- printf (" #define FILENAME_MAX %u\n",
-#ifdef PATH_MAX
- PATH_MAX
-#else
- /* This is supposed to be the size needed to hold the longest file
- name string the implementation guarantees can be opened.
- PATH_MAX not being defined means the actual limit on the length
- of a file name is runtime-variant (or it is unlimited). ISO
- says in such a case FILENAME_MAX should be a good size to
- allocate for a file name string. POSIX.1 guarantees that a
- file name up to _POSIX_PATH_MAX chars long can be opened, so
- this value must be at least that. */
- 1024 /* _POSIX_PATH_MAX is 255. */
-#endif
- );
-
- puts ("# undef __need_FOPEN_MAX");
- puts ("# define __need_FOPEN_MAX 1");
- puts ("#endif\n");
-
- /* POSIX does not require that OPEN_MAX and PATH_MAX be defined, so
- <bits/local_lim.h> will not define them if they are run-time
- variant (which is the case in the Hurd). ISO still requires
- that FOPEN_MAX and FILENAME_MAX be defined, however. */
-
- puts ("#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX");
- puts ("# define __defined_FOPEN_MAX");
- printf ("# define FOPEN_MAX %u\n",
-#ifdef OPEN_MAX
-
- OPEN_MAX
-#else
- /* This is the minimum number of files that the implementation
- guarantees can be open simultaneously. OPEN_MAX not being
- defined means the maximum is run-time variant; but POSIX.1
- requires that it never be less than _POSIX_OPEN_MAX, so that is
- a good minimum to use. */
- _POSIX_OPEN_MAX
-#endif
-
- );
- puts ("#endif");
- puts ("#undef __need_FOPEN_MAX");
-
- exit (0);
-}
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index e96ef14c92..66d926655e 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -1,5 +1,4 @@
bits/pthreadtypes.h
-stdio_lim.h.in
cmsg_nxthdr.c
errlist.h
init-first.h
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 6d6276a463..fa12c056e2 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -89,32 +89,6 @@ endif
# Don't compile the ctype glue code, since there is no old non-GNU C library.
inhibit-glue = yes
-# Tell sysdeps/posix/Makefile that we create stdio_lim.h differently.
-inhibit-stdio_lim = yes
-
-$(common-objpfx)bits/stdio_%.h $(common-objpfx)bits/stdio_%.d: \
- $(..)sysdeps/unix/sysv/linux/stdio_%.h.in
- rm -f $(@:.h=.d) $(@:.d=.h)-t
- echo '#include <linux/limits.h>' | \
- SUNPRO_DEPENDENCIES='$(@:.h=.d) \
- $(patsubst $(common-objpfx)%,$$(common-objpfx)%,\
- $(@:.d=.h) $(@:.h=.d))' \
- $(CC) -E -dM - > $(@:.d=.h)-t
- fopen_max=`sed -n 's/^#define OPEN_MAX //p' $(@:.d=.h)-t`; \
- filename_max=`sed -n 's/^#define PATH_MAX //p' $(@:.d=.h)-t`; \
- if test -n "$$fopen_max" && test -n "$$filename_max"; then \
- sed -e "s/DEFAULT_FOPEN_MAX/$$fopen_max/" \
- -e "s/DEFAULT_FILENAME_MAX/$$filename_max/" $< \
- > $(@:.d=.h).new && \
- mv -f $(@:.d=.h).new $(@:.d=.h); \
- else exit 1; fi
-# Remove this last so that it can be examined if something went wrong.
- rm -f $(@:.d=.h)-t
-ifndef no_deps
-# Get the list of dependencies (probably /usr/include/linux/limits.h).
--include $(common-objpfx)bits/stdio_lim.d
-endif
-
ifeq ($(subdir),signal)
sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait \
rt_sigqueueinfo rt_sigaction rt_sigpending
@@ -128,4 +102,3 @@ ifeq ($(subdir),nis)
CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
endif
-common-generated += bits/stdio_lim.h bits/stdio_lim.d
diff --git a/sysdeps/unix/sysv/linux/stdio_lim.h.in b/sysdeps/unix/sysv/linux/stdio_lim.h.in
deleted file mode 100644
index bded904ef0..0000000000
--- a/sysdeps/unix/sysv/linux/stdio_lim.h.in
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Stdio limits for Linux.
- Copyright (C) 1994, 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. */
-
-#if !defined _STDIO_H && !defined __need_FOPEN_MAX
-# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
-#endif
-
-#ifdef _STDIO_H
-# define L_tmpnam 19
-# define TMP_MAX 238328
-
-# ifdef __USE_POSIX
-# define L_ctermid 9
-# define L_cuserid 9
-# endif
-
-# define FILENAME_MAX DEFAULT_FILENAME_MAX
-
-# undef __need_FOPEN_MAX
-# define __need_FOPEN_MAX
-#endif
-
-#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX
-# define __defined_FOPEN_MAX
-# define FOPEN_MAX DEFAULT_FOPEN_MAX
-#endif
-#undef __need_FOPEN_MAX
diff --git a/timezone/tst-timezone.c b/timezone/tst-timezone.c
index 3585a9c60b..e866b94d10 100644
--- a/timezone/tst-timezone.c
+++ b/timezone/tst-timezone.c
@@ -89,9 +89,9 @@ main (int argc, char ** argv)
const struct test_times *pt;
char buf[BUFSIZ];
- /* This should be: Thu May 14 18:02:16 1998. */
+ /* This should be: Fri May 15 01:02:16 1998 (UTC). */
t = 895194136;
- printf ("We use this date: %s\n", ctime (&t));
+ printf ("We use this date: %s\n", asctime (gmtime (&t)));
for (pt = tests; pt->name != NULL; ++pt)
{
diff --git a/wcsmbs/wcsmbs-tst1.c b/wcsmbs/wcsmbs-tst1.c
index 30a7faf33e..72fbda5a4d 100644
--- a/wcsmbs/wcsmbs-tst1.c
+++ b/wcsmbs/wcsmbs-tst1.c
@@ -2,6 +2,7 @@
#include <wchar.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <wctype.h>
#include <locale.h>