[Hide Content]From a130abe2f76153e1eaa5a8ba6608b9c11ec65823 Mon Sep 17 00:00:00 2001
From: Jesse Jones <[email protected]>
Date: Wed, 29 Sep 2010 09:51:57 -0700
Subject: Fixed isDirectory so that it does not throw on errors (other processes could have removed the file system item)
---
src/common/fileutil.cc | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/common/fileutil.cc b/src/common/fileutil.cc
index 7d82aab..d75fea4 100644
--- a/src/common/fileutil.cc
+++ b/src/common/fileutil.cc
@@ -223,9 +223,8 @@ bool fileExists(const char *pathname)
bool isDirectory(const char *pathname)
{
struct stat statbuf;
- if (stat(pathname, &statbuf) != 0)
- throw opp_runtime_error("cannot stat file '%s': %s", pathname, strerror(errno));
- return (statbuf.st_mode & S_IFDIR) != 0;
+ int err = stat(pathname, &statbuf); // note that other processes may be changing the file system so we cannot throw if we get an error here
+ return err == 0 && (statbuf.st_mode & S_IFDIR) != 0;
}
void removeFile(const char *fname, const char *descr)
--
1.7.2.3