return false;
}
+ if(fflush(f)) {
+ logger(mesh, MESHLINK_ERROR, "Failed to flush file: %s", strerror(errno));
+ meshlink_errno = MESHLINK_ESTORAGE;
+ return false;
+ }
+
if(fsync(fileno(f))) {
logger(mesh, MESHLINK_ERROR, "Failed to sync file: %s\n", strerror(errno));
return false;
return false;
}
- if(fsync(fileno(f))) {
- logger(mesh, MESHLINK_ERROR, "Failed to sync `%s': %s", tmp_path, strerror(errno));
- fclose(f);
- return false;
- }
-
if(fclose(f)) {
logger(mesh, MESHLINK_ERROR, "Failed to close `%s': %s", tmp_path, strerror(errno));
return false;
return false;
}
- if(fsync(fileno(f))) {
- logger(mesh, MESHLINK_ERROR, "Failed to sync `%s': %s", tmp_path, strerror(errno));
- fclose(f);
- return false;
- }
-
if(rename(tmp_path, path)) {
logger(mesh, MESHLINK_ERROR, "Failed to rename `%s' to `%s': %s", tmp_path, path, strerror(errno));
fclose(f);
return false;
}
- if(fsync(fileno(f))) {
- logger(mesh, MESHLINK_ERROR, "Failed to sync `%s': %s", path, strerror(errno));
- fclose(f);
- return false;
- }
-
if(fclose(f)) {
logger(mesh, MESHLINK_ERROR, "Failed to close `%s': %s", path, strerror(errno));
return false;