[PATCH 5/6] commands: ubi: ubiupdatevol: Open device with O_TRUNC
Teresa Remmet
t.remmet at phytec.de
Fri Nov 25 00:06:06 PST 2016
Static ubi volumes should be opend with O_TRUNC as the device file
size equals the content.
Signed-off-by: Teresa Remmet <t.remmet at phytec.de>
---
commands/ubi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commands/ubi.c b/commands/ubi.c
index 4c445d2..5e27584 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;
--
1.9.1
More information about the barebox
mailing list