]> Sergey Matveev's repositories - nnn.git/commitdiff
Use raw functions instead of file functions
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 15 Jun 2021 09:49:06 +0000 (15:19 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 15 Jun 2021 09:58:53 +0000 (15:28 +0530)
src/nnn.c

index a005338c929024540ce76970a23ee462dd53f383..7c45748885a5fa5f8d32aad59027e0115320a2f0 100644 (file)
--- 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);
 }