|
|
@@ -106,17 +106,24 @@ sub guess_pkg_root_dir($) {
|
|
|
return undef;
|
|
|
}
|
|
|
|
|
|
-=item check_files_are_the_same($file1, $file2)
|
|
|
+=item check_files_are_the_same($file1, $file2, $resolve_symlink)
|
|
|
|
|
|
This function verifies that both files are the same by checking that the device
|
|
|
-numbers and the inode numbers returned by lstat() are the same.
|
|
|
+numbers and the inode numbers returned by stat()/lstat() are the same. If
|
|
|
+$resolve_symlink is true then stat() is used, otherwise lstat() is used.
|
|
|
|
|
|
=cut
|
|
|
-sub check_files_are_the_same($$) {
|
|
|
- my ($file1, $file2) = @_;
|
|
|
+sub check_files_are_the_same($$;$) {
|
|
|
+ my ($file1, $file2, $resolve_symlink) = @_;
|
|
|
return 0 if ((! -e $file1) || (! -e $file2));
|
|
|
- my @stat1 = lstat($file1);
|
|
|
- my @stat2 = lstat($file2);
|
|
|
+ my (@stat1, @stat2);
|
|
|
+ if ($resolve_symlink) {
|
|
|
+ @stat1 = stat($file1);
|
|
|
+ @stat2 = stat($file2);
|
|
|
+ } else {
|
|
|
+ @stat1 = lstat($file1);
|
|
|
+ @stat2 = lstat($file2);
|
|
|
+ }
|
|
|
my $result = ($stat1[0] == $stat2[0]) && ($stat1[1] == $stat2[1]);
|
|
|
return $result;
|
|
|
}
|