Truncate output file before writing in picker mode

This commit is contained in:
Arun Prakash Jana 2021-07-24 01:25:28 +05:30
parent 25fab4cb2e
commit e2545f9596
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 1 additions and 1 deletions

View File

@ -8476,7 +8476,7 @@ int main(int argc, char *argv[])
if (g_state.picker) {
if (selbufpos) {
fd = selpath ? open(selpath, O_WRONLY | O_CREAT, 0600) : STDOUT_FILENO;
fd = selpath ? open(selpath, O_WRONLY | O_CREAT | O_TRUNC, 0600) : STDOUT_FILENO;
if ((fd == -1) || (seltofile(fd, NULL) != (size_t)(selbufpos)))
xerror();