mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Make the maximum execve size test use sysconf. Create a fallback if sysconf is unavailable.
darcs-hash:20071015113936-75c98-078e9f8727e91d41fabc80827bf97c8e04dd97ba.gz
This commit is contained in:
parent
dd02e96712
commit
36e08dc49e
4 changed files with 45 additions and 12 deletions
|
@ -732,7 +732,7 @@ fi
|
||||||
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf )
|
AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf )
|
||||||
AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc )
|
AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc )
|
||||||
AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg gettext )
|
AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg gettext )
|
||||||
AC_CHECK_FUNCS( dcgettext backtrace backtrace_symbols)
|
AC_CHECK_FUNCS( dcgettext backtrace backtrace_symbols sysconf )
|
||||||
|
|
||||||
#
|
#
|
||||||
# The Makefile also needs to know if we have gettext, so it knows if
|
# The Makefile also needs to know if we have gettext, so it knows if
|
||||||
|
|
31
exec.c
31
exec.c
|
@ -507,6 +507,8 @@ static void launch_process( process_t *p )
|
||||||
string_buffer_t sz1;
|
string_buffer_t sz1;
|
||||||
string_buffer_t sz2;
|
string_buffer_t sz2;
|
||||||
|
|
||||||
|
long arg_max = -1;
|
||||||
|
|
||||||
sb_init( &sz1 );
|
sb_init( &sz1 );
|
||||||
sb_init( &sz2 );
|
sb_init( &sz2 );
|
||||||
|
|
||||||
|
@ -521,19 +523,26 @@ static void launch_process( process_t *p )
|
||||||
}
|
}
|
||||||
|
|
||||||
sb_format_size( &sz1, sz );
|
sb_format_size( &sz1, sz );
|
||||||
|
|
||||||
|
arg_max = sysconf( _SC_ARG_MAX );
|
||||||
|
|
||||||
#ifdef ARG_MAX
|
if( arg_max > 0 )
|
||||||
sb_format_size( &sz2, ARG_MAX );
|
{
|
||||||
|
|
||||||
|
sb_format_size( &sz2, ARG_MAX );
|
||||||
|
|
||||||
|
debug( 0,
|
||||||
|
L"The total size of the argument and environment lists (%ls) exceeds the system limit of %ls.",
|
||||||
|
(wchar_t *)sz1.buff,
|
||||||
|
(wchar_t *)sz2.buff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debug( 0,
|
||||||
|
L"The total size of the argument and environment lists (%ls) exceeds the system limit.",
|
||||||
|
(wchar_t *)sz1.buff);
|
||||||
|
}
|
||||||
|
|
||||||
debug( 0,
|
|
||||||
L"The total size of the argument and environment lists (%ls) exceeds the system limit of %ls.",
|
|
||||||
(wchar_t *)sz1.buff,
|
|
||||||
(wchar_t *)sz2.buff);
|
|
||||||
#else
|
|
||||||
debug( 0,
|
|
||||||
L"The total size of the argument and environment lists (%ls) exceeds the system limit.",
|
|
||||||
(wchar_t *)sz1.buff);
|
|
||||||
#endif
|
|
||||||
debug( 0,
|
debug( 0,
|
||||||
L"Please try running the command again with fewer arguments.");
|
L"Please try running the command again with fewer arguments.");
|
||||||
sb_destroy( &sz1 );
|
sb_destroy( &sz1 );
|
||||||
|
|
17
fallback.c
17
fallback.c
|
@ -1168,3 +1168,20 @@ char ** backtrace_symbols (void *const *buffer, int size)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_SYSCONF
|
||||||
|
|
||||||
|
long sysconf(int name)
|
||||||
|
{
|
||||||
|
if( name == _SC_ARG_MAX )
|
||||||
|
{
|
||||||
|
#ifdef ARG_MAX
|
||||||
|
return ARG_MAX;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -435,4 +435,11 @@ int getopt_long(int argc,
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_SYSCONF
|
||||||
|
|
||||||
|
#define _SC_ARG_MAX 1
|
||||||
|
long sysconf(int name);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue