summaryrefslogtreecommitdiff
path: root/Utility/Path.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2014-12-23 11:52:23 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2014-12-23 11:52:23 -0400
commit73c2b97d7d5b26c43aca2432776ea1dbe10be73d (patch)
tree02fa79088e0c74a19a3ab332dd7b6dd193dfb0f8 /Utility/Path.hs
parentc80b92b61f67ade14eb54633140ff046b285469c (diff)
Work around statfs() overflow on some XFS systems.
statfs(".", 0xffa8ad50) = -1 EOVERFLOW (Value too large for defined data type) Ref <20141222221621.GO7251@onerussian.com>
Diffstat (limited to 'Utility/Path.hs')
-rw-r--r--Utility/Path.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs
index d21452efd..c3e893d16 100644
--- a/Utility/Path.hs
+++ b/Utility/Path.hs
@@ -21,6 +21,7 @@ import Control.Applicative
import qualified System.FilePath.Posix as Posix
#else
import System.Posix.Files
+import Utility.Exception
#endif
import qualified "MissingH" System.Path as MissingH
@@ -255,7 +256,9 @@ fileNameLengthLimit :: FilePath -> IO Int
fileNameLengthLimit _ = return 255
#else
fileNameLengthLimit dir = do
- l <- fromIntegral <$> getPathVar dir FileNameLimit
+ -- getPathVar can fail due to statfs(2) overflow
+ l <- catchDefaultIO 0 $
+ fromIntegral <$> getPathVar dir FileNameLimit
if l <= 0
then return 255
else return $ minimum [l, 255]