aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRostislav Skudnov <rostislav@tuxera.com>2017-03-16 20:54:35 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-03-16 20:54:35 +0100
commitdba0dc1999bb1e8bfe64607e2a9385cda361fcb7 (patch)
treebd849a66f4f84dc258c6f6fb93e68db71107f04c
parenta98db793cffb77a8794c854443b8fe12bad98c0a (diff)
downloadbusybox-dba0dc1999bb1e8bfe64607e2a9385cda361fcb7.tar.gz
dd: call fsync() only once before exiting if conv=fsync is specified
Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/dd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 5e68087fc..7d980f1c4 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -532,11 +532,11 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
if (write_and_stats(ibuf, n, obs, outfile))
goto out_status;
}
+ }
- if (G.flags & FLAG_FSYNC) {
- if (fsync(ofd) < 0)
- goto die_outfile;
- }
+ if (G.flags & FLAG_FSYNC) {
+ if (fsync(ofd) < 0)
+ goto die_outfile;
}
if (ENABLE_FEATURE_DD_IBS_OBS && oc) {