aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Brucker <jean-philippe.brucker@arm.com>2019-04-04 14:20:44 +0100
committerWill Deacon <will.deacon@arm.com>2019-04-26 14:57:59 +0100
commit0964955ded23f40714231c820c0bb8cac7e08567 (patch)
tree5f89689755f210dd6109d8d2cbb685a0d1a7854e
parent5c5cae758a726ac073b68c8b0072c877d901589f (diff)
downloadkvmtool-0964955ded23f40714231c820c0bb8cac7e08567.tar.gz
guest: sync disk before shutting down
sync() should be called before reboot(RB_AUTOBOOT), otherwise data written to disks might be lost. Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--guest/init.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/guest/init.c b/guest/init.c
index 1f9cd048..52f6567d 100644
--- a/guest/init.c
+++ b/guest/init.c
@@ -72,6 +72,7 @@ int main(int argc, char *argv[])
} while (corpse != child);
}
+ sync();
reboot(RB_AUTOBOOT);
printf("Init failed: %s\n", strerror(errno));