Skip to content

Commit

Permalink
Merge branch 'hotfix/1.25.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Jan 10, 2024
2 parents 116069b + c13ab89 commit 83f6f3e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.25.1
1.25.2
6 changes: 6 additions & 0 deletions src/eckit/io/FDataSync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@
#include <unistd.h>

#include "eckit/eckit.h"
#include "eckit/os/Stat.h"

namespace eckit {


int fsync(int fd) {
Stat::Struct info;
if (Stat::fstat(fd, &info) == 0 && !S_ISREG(info.st_mode) && !S_ISLNK(info.st_mode)) {
return 0;
}

int ret = ::fsync(fd);
while (ret < 0 && errno == EINTR) {
ret = ::fsync(fd);
Expand Down
4 changes: 0 additions & 4 deletions src/eckit/io/FileHandle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ void FileHandle::flush() {

int ret = eckit::fsync(fileno(file_));

while (ret < 0 && errno == EINTR) {
ret = eckit::fsync(fileno(file_));
}

if (ret < 0) {
std::ostringstream oss;
oss << "Cannot fsync(" << name_ << ") " << fileno(file_);
Expand Down
6 changes: 2 additions & 4 deletions src/eckit/serialisation/FileStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "eckit/eckit.h"

#include "eckit/io/FDataSync.h"
#include "eckit/exception/Exceptions.h"
#include "eckit/log/Log.h"
#include "eckit/serialisation/FileStream.h"
Expand All @@ -39,11 +40,8 @@ void FileStream::close() {
// a power failure, we lose some data. So we
// need to fsync

int ret = fsync(fileno(file_));
int ret = eckit::fsync(fileno(file_));

while (ret < 0 && errno == EINTR) {
ret = fsync(fileno(file_));
}
if (ret < 0) {
Log::error() << "Cannot fsync(" << name_ << ") " << fileno(file_) << Log::syserr << std::endl;
}
Expand Down

0 comments on commit 83f6f3e

Please sign in to comment.