commit e2545f95966938dc1ef04f9aaa6bb565695b42ab
parent 25fab4cb2ef20140d2b2ac484e9ef6aa8171390a
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Sat, 24 Jul 2021 01:25:28 +0530
Truncate output file before writing in picker mode
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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();