freebsd-ports/sysutils/parallel/files/patch-src__parallel
Sunpoet Po-Chuan Hsieh 652bb3467e - Update to 20110205
Changes:	http://savannah.gnu.org/forum/forum.php?forum_id=6713
PR:		ports/154721
Submitted by:	Chris Howey <howeyc@gmail.com> (maintainer)
2011-02-13 03:32:23 +00:00

64 lines
2.2 KiB
Text

--- ./src/parallel.orig 2011-02-03 15:33:39.000000000 -0700
+++ ./src/parallel 2011-02-12 15:28:20.000000000 -0700
@@ -3542,28 +3542,42 @@
# Maximal command line length (for -m and -X)
sub max_length {
- # Find the max_length of a command line
- # Returns:
- # number of chars on the longest command line allowed
+ # FreeBSD code:
if(not $Limits::Command::line_max_len) {
- if($::opt_s) {
- if(is_acceptable_command_line_length($::opt_s)) {
- $Limits::Command::line_max_len = $::opt_s;
- } else {
- # -s is too long: Find the correct
- $Limits::Command::line_max_len = binary_find_max_length(0,$::opt_s);
- }
- if($::opt_s <= $Limits::Command::line_max_len) {
- $Limits::Command::line_max_len = $::opt_s;
- } else {
- print STDERR "$Global::progname: ",
- "value for -s option should be < $Limits::Command::line_max_len\n";
- }
- } else {
- $Limits::Command::line_max_len = real_max_length();
- }
+ $Limits::Command::line_max_len = `getconf ARG_MAX` - 1024;
+ if ($::opt_s) {
+ if ($::opt_s > $Limits::Command::line_max_len) {
+ print STDERR "$Global::progname: ",
+ "you are setting value for -s greater than $Limits::Command::line_max_len\n";
+ }
+ $Limits::Command::line_max_len = $::opt_s;
+ }
}
return $Limits::Command::line_max_len;
+
+# ORIGINAL code:
+# # Find the max_length of a command line
+# # Returns:
+# # number of chars on the longest command line allowed
+# if(not $Limits::Command::line_max_len) {
+# if($::opt_s) {
+# if(is_acceptable_command_line_length($::opt_s)) {
+# $Limits::Command::line_max_len = $::opt_s;
+# } else {
+# # -s is too long: Find the correct
+# $Limits::Command::line_max_len = binary_find_max_length(0,$::opt_s);
+# }
+# if($::opt_s <= $Limits::Command::line_max_len) {
+# $Limits::Command::line_max_len = $::opt_s;
+# } else {
+# print STDERR "$Global::progname: ",
+# "value for -s option should be < $Limits::Command::line_max_len\n";
+# }
+# } else {
+# $Limits::Command::line_max_len = real_max_length();
+# }
+# }
+# return $Limits::Command::line_max_len;
}
sub real_max_length {