gbasm: truncate file at end of output
When overwriting an old output file, this will delete the extra data if the new output is shorter than the old output.
This commit is contained in:
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
|
|||||||
close(out_fd);
|
close(out_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
out_fd = open(optarg, O_WRONLY | O_CREAT);
|
out_fd = open(optarg, O_WRONLY | O_CREAT | O_TRUNC);
|
||||||
if (out_fd < 0) {
|
if (out_fd < 0) {
|
||||||
fprintf(stderr, "failed to open output file %s\n", optarg);
|
fprintf(stderr, "failed to open output file %s\n", optarg);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user