From: Arun Prakash Jana Date: Fri, 23 Jul 2021 19:55:28 +0000 (+0530) Subject: Truncate output file before writing in picker mode X-Git-Tag: v4.3~78 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e2545f95966938dc1ef04f9aaa6bb565695b42ab;p=nnn.git Truncate output file before writing in picker mode --- 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();