improve error handling in flush operation

This commit is contained in:
Valient Gough 2016-09-08 10:13:38 +02:00
parent eaf2574d03
commit d99c2e2df2
No known key found for this signature in database
GPG Key ID: B515DCEB95967051

View File

@ -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;