Blame abicheck-1.2-ldlinux.patch

efb901c
diff -Nur abicheck-1.2-orig/abicheck.pl abicheck-1.2/abicheck.pl
efb901c
--- abicheck-1.2-orig/abicheck.pl	2003-08-26 21:57:51.000000000 +0200
efb901c
+++ abicheck-1.2/abicheck.pl	2005-08-16 22:49:06.000000000 +0200
efb901c
@@ -496,7 +496,7 @@
efb901c
 
efb901c
 	if ( ! $pid ) {
efb901c
 		# child here, go run ldd -r with debug env:
efb901c
-		exec_ldd($file);
efb901c
+		exec_ldd($file,$file0);
efb901c
 		exit 1;
efb901c
 	}
efb901c
 	
efb901c
@@ -1241,7 +1241,7 @@
efb901c
 # will read command output.
efb901c
 #
efb901c
 sub exec_ldd {
efb901c
-	my ($file) = @_;
efb901c
+	my ($file,$file0) = @_;
efb901c
 
efb901c
 	open(STDERR, ">&STDOUT");
efb901c
 	# need to close stdin on linux for some suid programs e.g. chsh (!)
efb901c
@@ -1251,10 +1251,27 @@
efb901c
 		$ENV{LD_LIBRARY_PATH} = $ld_path;
efb901c
 	}
efb901c
 
efb901c
-	# currently, no difference between OSs
efb901c
-	$ENV{LD_DEBUG} = "files,bindings";
efb901c
-	exec 'ldd', '-r', $file;
efb901c
-	exit 1;	# exec failed
efb901c
+	my $ldlinux = '';
efb901c
+	open(DLFIND,"ldd $file0 |") or die "open: ldd: $!";
efb901c
+	while (<DLFIND>) {
75b53bc
+	    /(\/ld(-linux[^.]*|64)*\.so\.\d+)/ and /(\S+)/ and $ldlinux = $1;
efb901c
+	}
efb901c
+	close(DLFIND);
efb901c
+	if ( $ldlinux =~ /^$/ ) {
efb901c
+	    # currently, no difference between OSs
efb901c
+	    $ENV{LD_DEBUG} = "files,bindings";
efb901c
+	    exec 'ldd', '-r', $file;
efb901c
+	    exit 1;	# exec failed
efb901c
+	}
efb901c
+	else {
efb901c
+	    $ENV{LD_DEBUG} = "files,bindings";
efb901c
+	    $ENV{LD_VERBOSE} = "yes";
efb901c
+	    $ENV{LD_WARN} = "yes";
efb901c
+	    $ENV{LD_BIND_NOW} = "yes";
efb901c
+	    $ENV{LD_TRACE_LOADED_OBJECTS} = "1";
efb901c
+	    exec $ldlinux, $file0;
efb901c
+	    exit 1;	# exec failed
efb901c
+	}
efb901c
 }
efb901c
 
efb901c
 #