diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-05-13 15:10:17 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-05-13 15:10:17 +0000 |
commit | c0ce886c9f6b0580924e4f21180602f5e72d6570 (patch) | |
tree | 97da271184cd7e513dac87fd821145e52a6b53de /libc | |
parent | ec66928153cc50fcb0748ffa9a2bced136c48895 (diff) | |
download | eglibc2-c0ce886c9f6b0580924e4f21180602f5e72d6570.tar.gz |
Merge changes between r13758 and r13800 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@13801 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc')
-rw-r--r-- | libc/ChangeLog | 33 | ||||
-rw-r--r-- | libc/NEWS | 12 | ||||
-rw-r--r-- | libc/elf/Makefile | 5 | ||||
-rw-r--r-- | libc/elf/dl-load.c | 48 | ||||
-rw-r--r-- | libc/elf/dl-lookup.c | 47 | ||||
-rw-r--r-- | libc/elf/tst-unique4.cc | 27 | ||||
-rw-r--r-- | libc/elf/tst-unique4.h | 7 | ||||
-rw-r--r-- | libc/elf/tst-unique4lib.cc | 17 | ||||
-rw-r--r-- | libc/manual/stdio.texi | 130 | ||||
-rw-r--r-- | libc/misc/mntent_r.c | 6 | ||||
-rw-r--r-- | libc/nptl/ChangeLog | 5 | ||||
-rw-r--r-- | libc/nptl/allocatestack.c | 2 | ||||
-rw-r--r-- | libc/sysdeps/posix/spawni.c | 4 |
13 files changed, 219 insertions, 124 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog index f4363afc9..824ec0e1c 100644 --- a/libc/ChangeLog +++ b/libc/ChangeLog @@ -1,10 +1,41 @@ +2011-05-12 Ulrich Drepper <drepper@gmail.com> + + [BZ #12511] + * elf/dl-lookup.c (enter): Don't test for copy relocation here and + don't set DF_1_NODELETE here. + (do_lookup_x): When entering new entry test for copy relocation + and if necessary set DF_1_NODELETE flag. + * elf/tst-unique4.cc: New file. + * elf/tst-unique4.h: New file. + * elf/tst-unique4lib.cc: New file. + * elf/Makefile: Add rules to build and run tst-unique4. + Patch by Piotr Bury <pbury@goahead.com>. + +2011-05-11 Ulrich Drepper <drepper@gmail.com> + + [BZ #12052] + * sysdeps/posix/spawni.c (__spawni): Fix sched_setscheduler call. + + [BZ #12625] + * misc/mntent_r.c (addmntent): Flush the stream after the output + + [BZ #12393] + * elf/dl-load.c (is_trusted_path): Remove unnecessary test. + (is_trusted_path_normalize): Skip initial colon. Append slash + to empty buffer. Duplicate is_trusted_path code but allow + constructed patch to be prefix. + (is_dst): Allow $ORIGIN followed by /. + (_dl_dst_substitute): Correct clearing of check_for_trusted. + Correct testing of result of is_trusted_path_normalize + (decompose_rpath): Fix warning. + 2011-05-10 Ulrich Drepper <drepper@gmail.com> [BZ #11257] * grp/initgroups.c (internal_getgrouplist): When we found the service list through the initgroups entry in nsswitch.conf do not always continue on a successful lookup. Don't always use the - __nss_group_data-ase value if it is set. + __nss_group_database value if it is set. * nss/nsswitch.conf (initgroups): Change action for successful db lookup to continue for compatibility. @@ -1,4 +1,4 @@ -GNU C Library NEWS -- history of user-visible changes. 2011-5-10 +GNU C Library NEWS -- history of user-visible changes. 2011-5-11 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc. See the end for copying conditions. @@ -9,11 +9,11 @@ Version 2.14 * The following bugs are resolved with this release: - 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11945, 11947, - 12158, 12178, 12200, 12346, 12393, 12420, 12445, 12449, 12454, 12460, - 12469, 12489, 12509, 12510, 12518, 12541, 12545, 12551, 12583, 12587, - 12597, 12611, 12631, 12650, 12653, 12655, 12660, 12681, 12685, 12711, - 12713, 12714, 12717, 12723, 12734, 12738 + 386, 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11945, 11947, + 12052, 12158, 12178, 12200, 12346, 12393, 12420, 12445, 12449, 12454, + 12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541, 12545, + 12551, 12583, 12587, 12597, 12611, 12625, 12631, 12650, 12653, 12655, + 12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12734, 12738 * The RPC implementation in libc is obsoleted. Old programs keep working but new programs cannot be linked with the routines in libc anymore. diff --git a/libc/elf/Makefile b/libc/elf/Makefile index 5ae389906..5cbcd410a 100644 --- a/libc/elf/Makefile +++ b/libc/elf/Makefile @@ -202,7 +202,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \ tst-audit1 tst-audit2 \ tst-stackguard1 tst-addr1 tst-thrlock \ - tst-unique1 tst-unique2 tst-unique3 \ + tst-unique1 tst-unique2 tst-unique3 tst-unique4 \ tst-initorder # reldep9 test-srcs = tst-pathopt @@ -260,6 +260,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ tst-unique1mod1 tst-unique1mod2 \ tst-unique2mod1 tst-unique2mod2 \ tst-unique3lib tst-unique3lib2 \ + tst-unique4lib \ tst-initordera1 tst-initorderb1 \ tst-initordera2 tst-initorderb2 \ tst-initordera3 tst-initordera4 @@ -1201,6 +1202,8 @@ $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so +$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so + $(objpfx)tst-initorder.out: $(objpfx)tst-initorder $(elf-objpfx)${rtld-installed-name} \ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ diff --git a/libc/elf/dl-load.c b/libc/elf/dl-load.c index bfc785cb9..94e2a07e1 100644 --- a/libc/elf/dl-load.c +++ b/libc/elf/dl-load.c @@ -171,10 +171,6 @@ local_strdup (const char *s) static bool is_trusted_path (const char *path, size_t len) { - /* All trusted directories must be complete names. */ - if (path[0] != '/') - return false; - const char *trun = system_dirs; for (size_t idx = 0; idx < nsystem_dirs_len; ++idx) @@ -193,9 +189,17 @@ is_trusted_path (const char *path, size_t len) static bool is_trusted_path_normalize (const char *path, size_t len) { + if (len == 0) + return false; + + if (*path == ':') + { + ++path; + --len; + } + char *npath = (char *) alloca (len + 2); char *wnp = npath; - while (*path != '\0') { if (path[0] == '/') @@ -225,11 +229,23 @@ is_trusted_path_normalize (const char *path, size_t len) *wnp++ = *path++; } - if (wnp > npath && wnp[-1] != '/') + + if (wnp == npath || wnp[-1] != '/') *wnp++ = '/'; - *wnp = '\0'; - return is_trusted_path (npath, wnp - npath); + const char *trun = system_dirs; + + for (size_t idx = 0; idx < nsystem_dirs_len; ++idx) + { + if (wnp - npath >= system_dirs_len[idx] + && memcmp (trun, npath, system_dirs_len[idx]) == 0) + /* Found it. */ + return true; + + trun += system_dirs_len[idx] + 1; + } + + return false; } @@ -265,7 +281,8 @@ is_dst (const char *start, const char *name, const char *str, return 0; if (__builtin_expect (secure, 0) - && ((name[len] != '\0' && (!is_path || name[len] != ':')) + && ((name[len] != '\0' && name[len] != '/' + && (!is_path || name[len] != ':')) || (name != start + 1 && (!is_path || name[-2] != ':')))) return 0; @@ -371,13 +388,12 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result, normalized path must be rooted in one of the trusted directories. */ if (__builtin_expect (check_for_trusted, false) - && is_trusted_path_normalize (last_elem, wp - last_elem)) - { - wp = last_elem; - check_for_trusted = false; - } + && !is_trusted_path_normalize (last_elem, wp - last_elem)) + wp = last_elem; else last_elem = wp; + + check_for_trusted = false; } } } @@ -386,7 +402,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result, /* In SUID/SGID programs, after $ORIGIN expansion the normalized path must be rooted in one of the trusted directories. */ if (__builtin_expect (check_for_trusted, false) - && is_trusted_path_normalize (last_elem, wp - last_elem)) + && !is_trusted_path_normalize (last_elem, wp - last_elem)) wp = last_elem; *wp = '\0'; @@ -628,7 +644,7 @@ decompose_rpath (struct r_search_path_struct *sps, if (*copy == 0) { free (copy); - sps->dirs = (char *) -1; + sps->dirs = (struct r_search_path_elem **) -1; return false; } diff --git a/libc/elf/dl-lookup.c b/libc/elf/dl-lookup.c index f878cac38..fa9b8fe2d 100644 --- a/libc/elf/dl-lookup.c +++ b/libc/elf/dl-lookup.c @@ -312,39 +312,21 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, definition we have to use it. */ void enter (struct unique_sym *table, size_t size, unsigned int hash, const char *name, - const ElfW(Sym) *sym, struct link_map *map) + const ElfW(Sym) *sym, const struct link_map *map) { size_t idx = hash % size; size_t hash2 = 1 + hash % (size - 2); - while (1) + while (table[idx].name != NULL) { - if (table[idx].name == NULL) - { - table[idx].hashval = hash; - table[idx].name = name; - if ((type_class & ELF_RTYPE_CLASS_COPY) != 0) - { - table[idx].sym = ref; - table[idx].map = undef_map; - } - else - { - table[idx].sym = sym; - table[idx].map = map; - - if (map->l_type == lt_loaded) - /* Make sure we don't unload this object by - setting the appropriate flag. */ - map->l_flags_1 |= DF_1_NODELETE; - } - - return; - } - idx += hash2; if (idx >= size) idx -= size; } + + table[idx].hashval = hash; + table[idx].name = name; + table[idx].sym = sym; + table[idx].map = map; } struct unique_sym_table *tab @@ -450,8 +432,19 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, tab->free = free; } - enter (entries, size, new_hash, strtab + sym->st_name, sym, - (struct link_map *) map); + if ((type_class & ELF_RTYPE_CLASS_COPY) != 0) + enter (entries, size, new_hash, strtab + sym->st_name, ref, + undef_map); + else + { + enter (entries, size, new_hash, strtab + sym->st_name, sym, + map); + + if (map->l_type == lt_loaded) + /* Make sure we don't unload this object by + setting the appropriate flag. */ + ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE; + } ++tab->n_elements; __rtld_lock_unlock_recursive (tab->lock); diff --git a/libc/elf/tst-unique4.cc b/libc/elf/tst-unique4.cc new file mode 100644 index 000000000..9eaa90998 --- /dev/null +++ b/libc/elf/tst-unique4.cc @@ -0,0 +1,27 @@ +// BZ 12511 +#include "tst-unique4.h" +#include <cstdio> + +static int a[24] = + { + S<1>::i, S<2>::i, S<3>::i, S<4>::i, S<5>::i, S<6>::i, S<7>::i, S<8>::i, + S<9>::i, S<10>::i, S<11>::i, S<12>::i, S<13>::i, S<14>::i, S<15>::i, + S<16>::i, S<17>::i, S<18>::i, S<19>::i, S<20>::i, S<21>::i, S<22>::i, + S<23>::i, S<24>::i + }; + +int +main (void) +{ + int result = 0; + for (int i = 0; i < 24; ++i) + { + printf("%d ", a[i]); + result |= a[i] != i + 1; + } + + printf("\n%d\n", S<1>::j); + result |= S<1>::j != -1; + + return result; +} diff --git a/libc/elf/tst-unique4.h b/libc/elf/tst-unique4.h new file mode 100644 index 000000000..2d377f5d5 --- /dev/null +++ b/libc/elf/tst-unique4.h @@ -0,0 +1,7 @@ +// BZ 12511 +template<int N> +struct S +{ + static int i; + static const int j; +}; diff --git a/libc/elf/tst-unique4lib.cc b/libc/elf/tst-unique4lib.cc new file mode 100644 index 000000000..c9fdf9cfe --- /dev/null +++ b/libc/elf/tst-unique4lib.cc @@ -0,0 +1,17 @@ +// BZ 12511 +#include "tst-unique4.h" + +template<int N> +int S<N>::i = N; +template<int N> +const int S<N>::j __attribute__ ((used)) = -1; + +static int a[24] = + { + S<1>::i, S<2>::i, S<3>::i, S<4>::i, S<5>::i, S<6>::i, S<7>::i, S<8>::i, + S<9>::i, S<10>::i, S<11>::i, S<12>::i, S<13>::i, S<14>::i, S<15>::i, + S<16>::i, S<17>::i, S<18>::i, S<19>::i, S<20>::i, S<21>::i, S<22>::i, + S<23>::i, S<24>::i + }; + +static int b = S<1>::j; diff --git a/libc/manual/stdio.texi b/libc/manual/stdio.texi index 0a70b04d7..94f9126c9 100644 --- a/libc/manual/stdio.texi +++ b/libc/manual/stdio.texi @@ -14,7 +14,7 @@ representing a communications channel to a file, device, or process. @menu * Streams:: About the data type representing a stream. * Standard Streams:: Streams to the standard input and output - devices are created for you. + devices are created for you. * Opening Streams:: How to create a stream to talk to a file. * Closing Streams:: Close a stream when you are finished with it. * Streams and Threads:: Issues with streams in threaded programs. @@ -26,17 +26,17 @@ representing a communications channel to a file, device, or process. * Block Input/Output:: Input and output operations on blocks of data. * Formatted Output:: @code{printf} and related functions. * Customizing Printf:: You can define new conversion specifiers for - @code{printf} and friends. + @code{printf} and friends. * Formatted Input:: @code{scanf} and related functions. * EOF and Errors:: How you can tell if an I/O error happens. * Error Recovery:: What you can do about errors. * Binary Streams:: Some systems distinguish between text files - and binary files. + and binary files. * File Positioning:: About random-access streams. * Portable Positioning:: Random access on peculiar ISO C systems. * Stream Buffering:: How to control buffering of streams. * Other Kinds of Streams:: Streams that do not necessarily correspond - to an open file. + to an open file. * Formatted Messages:: Print strictly formatted messages. @end menu @@ -186,13 +186,11 @@ but output is always appended to the end of the file. @end table As you can see, @samp{+} requests a stream that can do both input and -output. The ISO standard says that when using such a stream, you must -call @code{fflush} (@pxref{Stream Buffering}) or a file positioning -function such as @code{fseek} (@pxref{File Positioning}) when switching -from reading to writing or vice versa. Otherwise, internal buffers -might not be emptied properly. The GNU C library does not have this -limitation; you can do arbitrary reading and writing operations on a -stream in whatever order. +output. When using such a stream, you must call @code{fflush} +(@pxref{Stream Buffering}) or a file positioning function such as +@code{fseek} (@pxref{File Positioning}) when switching from reading +to writing or vice versa. Otherwise, internal buffers might not be +emptied properly. Additional characters may appear after these to specify flags for the call. Always put the mode (@samp{r}, @samp{w+}, etc.) first; that is @@ -1109,17 +1107,17 @@ y_or_n_p (const char *question) /* @r{Write a space to separate answer from question.} */ fputc (' ', stdout); /* @r{Read the first character of the line.} - @r{This should be the answer character, but might not be.} */ + @r{This should be the answer character, but might not be.} */ c = tolower (fgetc (stdin)); answer = c; /* @r{Discard rest of input line.} */ while (c != '\n' && c != EOF) - c = fgetc (stdin); + c = fgetc (stdin); /* @r{Obey the answer if it was valid.} */ if (answer == 'y') - return 1; + return 1; if (answer == 'n') - return 0; + return 0; /* @r{Answer was invalid: ask for valid answer.} */ fputs ("Please answer y or n:", stdout); @} @@ -1328,7 +1326,7 @@ situation looks like this: @smallexample f o o b a r - ^ + ^ @end smallexample @noindent @@ -1340,7 +1338,7 @@ situation like this: @smallexample f o o b a r - | + | o-- ^ @end smallexample @@ -1354,7 +1352,7 @@ If you unread @samp{9} instead of @samp{o}, you get this situation: @smallexample f o o b a r - | + | 9-- ^ @end smallexample @@ -1527,19 +1525,19 @@ useful for printing error messages, tables of data, and the like. @menu * Formatted Output Basics:: Some examples to get you started. * Output Conversion Syntax:: General syntax of conversion - specifications. + specifications. * Table of Output Conversions:: Summary of output conversions and - what they do. + what they do. * Integer Conversions:: Details about formatting of integers. * Floating-Point Conversions:: Details about formatting of - floating-point numbers. + floating-point numbers. * Other Output Conversions:: Details about formatting of strings, - characters, pointers, and the like. + characters, pointers, and the like. * Formatted Output Functions:: Descriptions of the actual functions. * Dynamic Output:: Functions that allocate memory for the output. * Variable Arguments Output:: @code{vprintf} and friends. * Parsing a Template String:: What kinds of args does a given template - call for? + call for? * Example of Parsing:: Sample program using @code{parse_printf_format}. @end menu @@ -1561,7 +1559,7 @@ formatted and written to the output stream. For example, int pct = 37; char filename[] = "foo.txt"; printf ("Processing of `%s' is %d%% finished.\nPlease be patient.\n", - filename, pct); + filename, pct); @end smallexample @noindent @@ -2350,20 +2348,20 @@ make_message (char *name, char *value) /* @r{Try to print in the allocated space.} */ nchars = snprintf (buffer, size, "value of %s is %s", - name, value); + name, value); @end group @group if (nchars >= size) @{ /* @r{Reallocate buffer now that we know - how much space is needed.} */ + how much space is needed.} */ size = nchars + 1; buffer = (char *) xrealloc (buffer, size); if (buffer != NULL) - /* @r{Try again.} */ - snprintf (buffer, size, "value of %s is %s", - name, value); + /* @r{Try again.} */ + snprintf (buffer, size, "value of %s is %s", + name, value); @} /* @r{The last call worked, return the string.} */ return buffer; @@ -2452,7 +2450,7 @@ For example: @smallexample #define myprintf(a, b, c, d, e, rest...) \ - printf (mytemplate , ## rest) + printf (mytemplate , ## rest) @end smallexample @noindent @@ -2594,7 +2592,7 @@ For example, take this declaration of @code{eprintf}: @smallexample void eprintf (const char *template, ...) - __attribute__ ((format (printf, 1, 2))); + __attribute__ ((format (printf, 1, 2))); @end smallexample @noindent @@ -2781,30 +2779,30 @@ validate_args (char *format, int nargs, OBJECT *args) int wanted; if (argtypes[i] & PA_FLAG_PTR) - wanted = STRUCTURE; + wanted = STRUCTURE; else - switch (argtypes[i] & ~PA_FLAG_MASK) - @{ - case PA_INT: - case PA_FLOAT: - case PA_DOUBLE: - wanted = NUMBER; - break; - case PA_CHAR: - wanted = CHAR; - break; - case PA_STRING: - wanted = STRING; - break; - case PA_POINTER: - wanted = STRUCTURE; - break; - @} + switch (argtypes[i] & ~PA_FLAG_MASK) + @{ + case PA_INT: + case PA_FLOAT: + case PA_DOUBLE: + wanted = NUMBER; + break; + case PA_CHAR: + wanted = CHAR; + break; + case PA_STRING: + wanted = STRING; + break; + case PA_POINTER: + wanted = STRUCTURE; + break; + @} if (TYPE (args[i]) != wanted) - @{ - error ("type mismatch for arg number %d", i); - return 0; - @} + @{ + error ("type mismatch for arg number %d", i); + return 0; + @} @} return 1; @} @@ -2835,15 +2833,15 @@ The facilities of this section are declared in the header file @menu * Registering New Conversions:: Using @code{register_printf_function} - to register a new output conversion. + to register a new output conversion. * Conversion Specifier Options:: The handler must be able to get - the options specified in the - template when it is called. + the options specified in the + template when it is called. * Defining the Output Handler:: Defining the handler and arginfo - functions that are passed as arguments - to @code{register_printf_function}. + functions that are passed as arguments + to @code{register_printf_function}. * Printf Extension Example:: How to define a @code{printf} - handler function. + handler function. * Predefined Printf Handlers:: Predefined @code{printf} handlers. @end menu @@ -3010,7 +3008,7 @@ You should define your handler functions with a prototype like: @smallexample int @var{function} (FILE *stream, const struct printf_info *info, - const void *const *args) + const void *const *args) @end smallexample The @var{stream} argument passed to the handler function is the stream to @@ -3058,7 +3056,7 @@ You have to define these functions with a prototype like: @smallexample int @var{function} (const struct printf_info *info, - size_t n, int *argtypes) + size_t n, int *argtypes) @end smallexample The return value from the function should be the number of arguments the @@ -3728,7 +3726,7 @@ conversion specification to read a ``variable assignment'' of the form char *variable, *value; if (2 > scanf ("%a[a-zA-Z0-9] = %a[^\n]\n", - &variable, &value)) + &variable, &value)) @{ invalid_input_error (); return 0; @@ -4781,10 +4779,10 @@ provide equivalent functionality. @menu * String Streams:: Streams that get data from or put data in - a string or memory buffer. + a string or memory buffer. * Obstack Streams:: Streams that store data in an obstack. * Custom Streams:: Defining your own streams with an arbitrary - input data source and/or output data sink. + input data source and/or output data sink. @end menu @node String Streams @@ -4958,9 +4956,9 @@ and types described here are all GNU extensions. @menu * Streams and Cookies:: The @dfn{cookie} records where to fetch or - store data that is read or written. + store data that is read or written. * Hook Functions:: How you should define the four @dfn{hook - functions} that a custom stream needs. + functions} that a custom stream needs. @end menu @node Streams and Cookies diff --git a/libc/misc/mntent_r.c b/libc/misc/mntent_r.c index 959852832..6959f0e21 100644 --- a/libc/misc/mntent_r.c +++ b/libc/misc/mntent_r.c @@ -1,5 +1,5 @@ /* Utilities for reading/writing fstab, mtab, etc. - Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010 + Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -263,8 +263,8 @@ __addmntent (FILE *stream, const struct mntent *mnt) mntcopy.mnt_type, mntcopy.mnt_opts, mntcopy.mnt_freq, - mntcopy.mnt_passno) - < 0 ? 1 : 0); + mntcopy.mnt_passno) < 0 + || fflush (stream) != 0); } weak_alias (__addmntent, addmntent) diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog index f99dcfb22..436952d13 100644 --- a/libc/nptl/ChangeLog +++ b/libc/nptl/ChangeLog @@ -1,3 +1,8 @@ +2011-05-11 Ulrich Drepper <drepper@gmail.com> + + [BZ #386] + * allocatestack.c (allocate_stack): Convert ENOMEM error to EAGAIN. + 2011-04-10 Ulrich Drepper <drepper@gmail.com> [BZ #12650] diff --git a/libc/nptl/allocatestack.c b/libc/nptl/allocatestack.c index ba251b916..82408f517 100644 --- a/libc/nptl/allocatestack.c +++ b/libc/nptl/allocatestack.c @@ -637,7 +637,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, { int err; mprot_error: - err = errno; + err = errno == ENOMEM ? EAGAIN : errno; lll_lock (stack_cache_lock, LLL_PRIVATE); diff --git a/libc/sysdeps/posix/spawni.c b/libc/sysdeps/posix/spawni.c index c5a827d6d..f19862fff 100644 --- a/libc/sysdeps/posix/spawni.c +++ b/libc/sysdeps/posix/spawni.c @@ -143,9 +143,7 @@ __spawni (pid_t *pid, const char *file, } else if ((flags & POSIX_SPAWN_SETSCHEDULER) != 0) { - if (__sched_setscheduler (0, attrp->__policy, - (flags & POSIX_SPAWN_SETSCHEDPARAM) != 0 - ? &attrp->__sp : NULL) == -1) + if (__sched_setscheduler (0, attrp->__policy, &attrp->__sp) == -1) _exit (SPAWN_ERROR); } #endif |