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