D13100: do not use buffered file IO
Albert Astals Cid
noreply at phabricator.kde.org
Thu Oct 25 23:30:27 BST 2018
aacid accepted this revision.
aacid added a comment.
This revision is now accepted and ready to land.
Please make me const-happy before commiting :)
INLINE COMMENTS
> pam_kwallet.c:696
> char *salt = gcry_random_bytes(KWALLET_PAM_SALTSIZE, GCRY_STRONG_RANDOM);
> - FILE *fd = fopen(path, "w");
> + int fd = open(path, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0600);
>
const
> pam_kwallet.c:704
>
> - fwrite(salt, KWALLET_PAM_SALTSIZE, 1, fd);
> - fclose(fd);
> + ssize_t wlen = write(fd, salt, KWALLET_PAM_SALTSIZE);
> + close(fd);
const
> pam_kwallet.c:755
>
> - FILE *fd = fopen(path, "r");
> - if (fd == NULL) {
> + int fd = open(path, O_RDONLY | O_CLOEXEC);
> + if (fd == -1) {
const
> pam_kwallet.c:764
> char salt[KWALLET_PAM_SALTSIZE] = {};
> - const int bytesRead = fread(salt, 1, KWALLET_PAM_SALTSIZE, fd);
> - fclose(fd);
> + ssize_t bytesRead = read(fd, salt, KWALLET_PAM_SALTSIZE);
> + close(fd);
const
REVISION DETAIL
https://phabricator.kde.org/D13100
To: dakon, aacid
Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20181025/ec526c66/attachment-0001.html>
More information about the Plasma-devel
mailing list