From 078c214d0f0e15bfd87fbdb86b0ac627f2c4eff8 Mon Sep 17 00:00:00 2001 From: Gerd von Egidy Date: Wed, 16 Dec 2015 15:33:09 +0100 Subject: [PATCH] add safeguard against infinite loop with EINTR, even if that case is very unlikely --- src/filefunc.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/filefunc.cpp b/src/filefunc.cpp index 6f07011..3a7f7c1 100644 --- a/src/filefunc.cpp +++ b/src/filefunc.cpp @@ -968,8 +968,10 @@ long long get_free_diskspace(const std::string& path) { struct statvfs sf; + int looplimit=10000; int ret; - while ( ((ret=statvfs(path.c_str(),&sf)) == -1) && (errno==EINTR) ); + while ( ((ret=statvfs(path.c_str(),&sf)) == -1) && (errno==EINTR) && looplimit > 0) + looplimit--; if (ret==-1) { -- 1.7.1