From d99c2e2df289dad19a4c0ec554761698ea115c0a Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Thu, 8 Sep 2016 10:13:38 +0200 Subject: [PATCH] improve error handling in flush operation --- encfs/encfs.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp index 31d3e7d..e87fcaa 100644 --- a/encfs/encfs.cpp +++ b/encfs/encfs.cpp @@ -564,8 +564,14 @@ int _do_flush(FileNode *fnode) { int res = fnode->open(O_RDONLY); if (res >= 0) { int fh = res; - res = close(dup(fh)); - if (res == -1) res = -errno; + int nfh = dup(fh); + if (nfh == -1) { + return -errno; + } + res = close(nfh); + if (res == -1) { + return -errno; + } } return res;