From e2545f95966938dc1ef04f9aaa6bb565695b42ab Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 24 Jul 2021 01:25:28 +0530 Subject: [PATCH] Truncate output file before writing in picker mode --- src/nnn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index 2fc1039d..b240a63e 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -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();