Use raw functions instead of file functions

This commit is contained in:
Arun Prakash Jana 2021-06-15 15:19:06 +05:30
parent a007fe8493
commit 745a30ccb5
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -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);
}