tunables: report sbrk() failure

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
DJ Delorie 2019-12-13 13:36:58 -05:00
parent a2e487ce1c
commit a059f9505b
1 changed files with 4 additions and 5 deletions

View File

@ -45,12 +45,11 @@ tunables_strdup (const char *in)
while (in[i++] != '\0'); while (in[i++] != '\0');
char *out = __sbrk (i); char *out = __sbrk (i);
/* FIXME: In reality if the allocation fails, __sbrk will crash attempting to /* For most of the tunables code, we ignore user errors. However,
set the thread-local errno since the TCB has not yet been set up. This this is a system error - and running out of memory at program
needs to be fixed with an __sbrk implementation that does not set startup should be reported, so we do. */
errno. */
if (out == (void *)-1) if (out == (void *)-1)
return NULL; _dl_fatal_printf ("sbrk() failure while processing tunables\n");
i--; i--;