mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-25 11:42:10 +01:00
thread: Check sysconf value before using it
sysconf() is documented as returning -1 if it can't determine a minimum thread stack size. Check for this case before using the return value. https://bugzilla.gnome.org/show_bug.cgi?id=739122
This commit is contained in:
parent
916297be79
commit
f7b13e05f9
@ -1159,7 +1159,9 @@ g_system_thread_new (GThreadFunc thread_func,
|
||||
if (stack_size)
|
||||
{
|
||||
#ifdef _SC_THREAD_STACK_MIN
|
||||
stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), stack_size);
|
||||
long min_stack_size = sysconf (_SC_THREAD_STACK_MIN);
|
||||
if (min_stack_size >= 0)
|
||||
stack_size = MAX (min_stack_size, stack_size);
|
||||
#endif /* _SC_THREAD_STACK_MIN */
|
||||
/* No error check here, because some systems can't do it and
|
||||
* we simply don't want threads to fail because of that. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user