summaryrefslogtreecommitdiff
path: root/sysutils/parallel/files/patch-src__parallel
blob: 1804fc5f434486cfd4cfd5a620bfe12ddfd8e9a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--- ./src/parallel.orig	2012-12-22 14:56:17.000000000 -0600
+++ ./src/parallel	2012-12-22 14:58:55.000000000 -0600
@@ -4790,29 +4790,19 @@
 package Limits::Command;
 
 # Maximal command line length (for -m and -X)
-sub max_length {
-    # Find the max_length of a command line and cache it
-    # 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 {
-		::warning("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 max_length {                                                                 
+    # FreeBSD code:                                                                 
+    if(not $Limits::Command::line_max_len) {                                        
+    	$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;                                          
 }
 
 sub real_max_length {