From: Rostislav Skudnov Date: Thu, 16 Mar 2017 19:54:35 +0000 (+0100) Subject: dd: call fsync() only once before exiting if conv=fsync is specified X-Git-Tag: 1_27_0~109 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dba0dc1999bb1e8bfe64607e2a9385cda361fcb7;p=oweals%2Fbusybox.git dd: call fsync() only once before exiting if conv=fsync is specified Signed-off-by: Rostislav Skudnov Signed-off-by: Denys Vlasenko --- 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) {