nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 745a30ccb54afb011579b9bdfbf4465b4f1e3844
parent a007fe84934c1442619007784f091e9343f80e4c
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Tue, 15 Jun 2021 15:19:06 +0530

Use raw functions instead of file functions

Diffstat:
Msrc/nnn.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 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); }