mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 13:51:31 +00:00
Truncate output file before writing in picker mode
This commit is contained in:
parent
25fab4cb2e
commit
e2545f9596
|
@ -8476,7 +8476,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (g_state.picker) {
|
if (g_state.picker) {
|
||||||
if (selbufpos) {
|
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)))
|
if ((fd == -1) || (seltofile(fd, NULL) != (size_t)(selbufpos)))
|
||||||
xerror();
|
xerror();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue