Commit 8c46f0c9 authored by Magnus Hagander's avatar Magnus Hagander

Don't fsync() files when --no-sync is specified

Michael Paquier
parent 10c064ce
...@@ -611,6 +611,9 @@ tar_sync(Walfile f) ...@@ -611,6 +611,9 @@ tar_sync(Walfile f)
Assert(f != NULL); Assert(f != NULL);
tar_clear_error(); tar_clear_error();
if (!tar_data->sync)
return 0;
/* /*
* Always sync the whole tarfile, because that's all we can do. This makes * Always sync the whole tarfile, because that's all we can do. This makes
* no sense on compressed files, so just ignore those. * no sense on compressed files, so just ignore those.
...@@ -842,6 +845,7 @@ tar_finish(void) ...@@ -842,6 +845,7 @@ tar_finish(void)
#endif #endif
/* sync the empty blocks as well, since they're after the last file */ /* sync the empty blocks as well, since they're after the last file */
if (tar_data->sync)
fsync(tar_data->fd); fsync(tar_data->fd);
if (close(tar_data->fd) != 0) if (close(tar_data->fd) != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment