From 745a30ccb54afb011579b9bdfbf4465b4f1e3844 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 15 Jun 2021 15:19:06 +0530 Subject: [PATCH] Use raw functions instead of file functions --- src/nnn.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index a005338c..7c457488 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1377,12 +1377,12 @@ static void writesel(const char *buf, const size_t buflen) if (!selpath) return; - FILE *fp = fopen(selpath, "w"); + int fd = open(selpath, O_CREAT | O_WRONLY | O_TRUNC, 0666); - if (fp) { - if (fwrite(buf, 1, buflen, fp) != buflen) + if (fd != -1) { + if (write(fd, buf, buflen) != (ssize_t)buflen) printwarn(NULL); - fclose(fp); + close(fd); } else printwarn(NULL); }