summaryrefslogtreecommitdiff
path: root/zen/dir_watcher.cpp
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-08-31 20:07:13 -0400
committerB Stack <bgstack15@gmail.com>2020-08-31 20:07:13 -0400
commit8a27fa9c617533e76673ce61a65e2ba869b52208 (patch)
treeacfdfb3e1046db87040477033fda0df76d92916a /zen/dir_watcher.cpp
parentMerge branch '11.0' into 'master' (diff)
downloadFreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.tar.gz
FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.tar.bz2
FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.zip
add upstream 11.1
Diffstat (limited to 'zen/dir_watcher.cpp')
-rw-r--r--zen/dir_watcher.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/zen/dir_watcher.cpp b/zen/dir_watcher.cpp
index d02e229e..62493084 100644
--- a/zen/dir_watcher.cpp
+++ b/zen/dir_watcher.cpp
@@ -57,14 +57,12 @@ DirWatcher::DirWatcher(const Zstring& dirPath) : //throw FileError
ZEN_ON_SCOPE_FAIL( ::close(pimpl_->notifDescr); );
//set non-blocking mode
- bool initSuccess = false;
- {
- int flags = ::fcntl(pimpl_->notifDescr, F_GETFL);
- if (flags != -1)
- initSuccess = ::fcntl(pimpl_->notifDescr, F_SETFL, flags | O_NONBLOCK) == 0;
- }
- if (!initSuccess)
- THROW_LAST_FILE_ERROR(replaceCpy(_("Cannot monitor directory %x."), L"%x", fmtPath(baseDirPath_)), "fcntl");
+ const int flags = ::fcntl(pimpl_->notifDescr, F_GETFL);
+ if (flags == -1)
+ THROW_LAST_FILE_ERROR(replaceCpy(_("Cannot monitor directory %x."), L"%x", fmtPath(baseDirPath_)), "fcntl(F_GETFL)");
+
+ if (::fcntl(pimpl_->notifDescr, F_SETFL, flags | O_NONBLOCK) != 0)
+ THROW_LAST_FILE_ERROR(replaceCpy(_("Cannot monitor directory %x."), L"%x", fmtPath(baseDirPath_)), "fcntl(F_SETFL, O_NONBLOCK)");
//add watches
for (const Zstring& subDirPath : fullFolderList)
bgstack15