1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

firmware-utils: when using open with O_CREAT and O_WRONLY, also use O_TRUNC to ensure that overwritten files have the right size (fixes #3505)

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12667 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd
2008-09-23 16:12:40 +00:00
parent afb3c4be87
commit 1e232a2ad2
3 changed files with 4 additions and 4 deletions

View File

@@ -143,7 +143,7 @@ static int gen_ptable(int nr)
printf("%ld\n", ((long) len * 512));
}
if ((fd = open(filename, O_WRONLY|O_CREAT, 0644)) < 0) {
if ((fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644)) < 0) {
fprintf(stderr, "Can't open output file '%s'\n",filename);
return -1;
}