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)
SVN-Revision: 12667
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user