_sbrk(): Return -1 rather than aborting if too much memory is requested.
This commit is contained in:
parent
104c3be681
commit
b2db0ebcfe
@ -1,3 +1,8 @@
|
|||||||
|
2002-01-17 Nick Clifton <nickc@cambridge.redhat.com>
|
||||||
|
|
||||||
|
* libc/sys/arm/syscalls.c (_sbrk): Return -1 rather than aborting
|
||||||
|
if too much memory is requested.
|
||||||
|
|
||||||
2002-01-11 Jeff Johnston <jjohnstn@redhat.com>
|
2002-01-11 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
* libc/stdio/vfscanf.c (__svfscanf_r): Change loop that
|
* libc/stdio/vfscanf.c (__svfscanf_r): Change loop that
|
||||||
|
@ -470,8 +470,6 @@ _getpid (int n)
|
|||||||
n = n;
|
n = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void abort (void);
|
|
||||||
|
|
||||||
caddr_t
|
caddr_t
|
||||||
_sbrk (int incr)
|
_sbrk (int incr)
|
||||||
{
|
{
|
||||||
@ -486,8 +484,18 @@ _sbrk (int incr)
|
|||||||
|
|
||||||
if (heap_end + incr > stack_ptr)
|
if (heap_end + incr > stack_ptr)
|
||||||
{
|
{
|
||||||
|
/* Some of the libstdc++-v3 tests rely upon detecting
|
||||||
|
out of memory errors, so do not abort here. */
|
||||||
|
#if 0
|
||||||
|
extern void abort (void);
|
||||||
|
|
||||||
_write (1, "_sbrk: Heap and stack collision\n", 32);
|
_write (1, "_sbrk: Heap and stack collision\n", 32);
|
||||||
|
|
||||||
abort ();
|
abort ();
|
||||||
|
#else
|
||||||
|
errno = ENOMEM;
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
heap_end += incr;
|
heap_end += incr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user