sh should truncate for new files

This commit is contained in:
K. Lange 2018-07-17 17:08:44 +09:00
parent e7b2e5a006
commit 188b4b4a04

View File

@ -602,7 +602,7 @@ _done:
if (next_is_file) {
if (next_is_file == 1 && !strcmp(c, WRITE_TOKEN)) {
next_is_file = 2;
file_args[cmdi] |= O_APPEND;
file_args[cmdi] = O_WRONLY | O_CREAT | O_APPEND;
continue;
}
output_files[cmdi] = c;
@ -611,7 +611,7 @@ _done:
if (!strcmp(c, WRITE_TOKEN)) {
next_is_file = 1;
file_args[cmdi] = O_WRONLY | O_CREAT;
file_args[cmdi] = O_WRONLY | O_CREAT | O_TRUNC;
continue;
}