From 4448dbb2e8d02cae7bfe56b969317ec6ad5027e5 Mon Sep 17 00:00:00 2001 From: Teresa Remmet Date: Fri, 25 Nov 2016 09:06:06 +0100 Subject: commands: ubi: ubiupdatevol: Open device with O_TRUNC Static ubi volumes should be opend with O_TRUNC as the device file size equals the content. Signed-off-by: Teresa Remmet Signed-off-by: Sascha Hauer --- commands/ubi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/ubi.c b/commands/ubi.c index 4c445d2216..5e2758400a 100644 --- a/commands/ubi.c +++ b/commands/ubi.c @@ -42,7 +42,7 @@ static int do_ubiupdatevol(int argc, char *argv[]) return 1; } - fd_vol = open(argv[optind], O_WRONLY); + fd_vol = open(argv[optind], O_WRONLY | O_TRUNC); if (fd_vol < 0) { perror("open volume"); ret = 1; -- cgit v1.2.3