X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FLib.pm;h=011e394b17a49c8af6a0bce51d49e6c9bb6d9c68;hp=88db7f87a8c156bbb01302e4c6515b1c9e623d50;hb=2726b96b1a7026dc3f82250afbfe5ae27ab1c75f;hpb=fadae1eaa5482a441bc8e8aa829a063ee6a5f0c0 diff --git a/lib/BackupPC/Lib.pm b/lib/BackupPC/Lib.pm index 88db7f8..011e394 100644 --- a/lib/BackupPC/Lib.pm +++ b/lib/BackupPC/Lib.pm @@ -11,7 +11,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2003 Craig Barratt +# Copyright (C) 2001-2007 Craig Barratt # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -72,7 +72,20 @@ require DynaLoader; BEGIN { eval "use IO::Dirent qw( readdirent DT_DIR );"; - $IODirentOk = 1 if ( !$@ ); + if ( !$@ && opendir(my $fh, ".") ) { + # + # Make sure the IO::Dirent really works - some installs + # on certain file systems don't return a valid type. + # + my $dt_dir = eval("DT_DIR"); + foreach my $e ( readdirent($fh) ) { + if ( $e->{name} eq "." && $e->{type} == $dt_dir ) { + $IODirentOk = 1; + last; + } + } + closedir($fh); + } }; #