[git commit] dd: call fsync() only once before exiting if conv=fsync is specified

Denys Vlasenko vda.linux at googlemail.com
Thu Mar 16 19:54:35 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=dba0dc1999bb1e8bfe64607e2a9385cda361fcb7
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Rostislav Skudnov <rostislav at tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/dd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/coreutils/dd.c b/coreutils/dd.c
index 5e68087..7d980f1 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) {


More information about the busybox-cvs mailing list