diff options
Diffstat (limited to 'libbb/sysconf.c')
-rw-r--r-- | libbb/sysconf.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libbb/sysconf.c b/libbb/sysconf.c index cfad9cdc0..8c1caef5c 100644 --- a/libbb/sysconf.c +++ b/libbb/sysconf.c | |||
@@ -11,7 +11,15 @@ | |||
11 | #if !defined(bb_arg_max) | 11 | #if !defined(bb_arg_max) |
12 | unsigned FAST_FUNC bb_arg_max(void) | 12 | unsigned FAST_FUNC bb_arg_max(void) |
13 | { | 13 | { |
14 | return sysconf(_SC_ARG_MAX); | 14 | long r = sysconf(_SC_ARG_MAX); |
15 | |||
16 | /* I've seen a version of uclibc which returned -1. | ||
17 | * Guard about it, and also avoid insanely large values | ||
18 | */ | ||
19 | if ((unsigned long)r > 64*1024*1024) | ||
20 | r = 64*1024*1024; | ||
21 | |||
22 | return r; | ||
15 | } | 23 | } |
16 | #endif | 24 | #endif |
17 | 25 | ||