From: Gerd von Egidy Date: Wed, 16 Dec 2015 14:33:09 +0000 (+0100) Subject: add safeguard against infinite loop with EINTR, even if that case is very unlikely X-Git-Tag: v2.8~13 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=078c214d0f0e15bfd87fbdb86b0ac627f2c4eff8;p=libi2ncommon add safeguard against infinite loop with EINTR, even if that case is very unlikely --- 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) {