After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778269 - Erroneous handling of partial writes in write_sync_close.
Erroneous handling of partial writes in write_sync_close.
Status: RESOLVED FIXED
Product: gnome-keyring
Classification: Core
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-02-07 09:47 UTC by Tomasz Miąsko
Modified: 2017-02-08 11:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] Fix write_sync_close in case of partial writes. (784 bytes, patch)
2017-02-07 10:35 UTC, Tomasz Miąsko
none Details | Review
Fix write_sync_close in case of partial writes. (830 bytes, patch)
2017-02-08 11:23 UTC, Jeremy Bicha
none Details | Review

Description Tomasz Miąsko 2017-02-07 09:47:34 UTC
The write_sync_close function from gnome-keyring/pkcs11/gkm/gkm-transaction.c,
works incorrectly in presence of partial writes. The main write loop looks as
follows:

  while (n_data > 0) {
    res = write (fd, data, n_data);
    if (res < 0) {
      ...
    }
    n_data -= MAX (res, n_data);
  }

Thus after a single iteration n_data will be always zero, even if not
everything have been written so far.
Comment 1 Stef Walter 2017-02-07 09:48:17 UTC
A patch would be more than welcome.
Comment 2 Tomasz Miąsko 2017-02-07 10:35:18 UTC
Created attachment 345094 [details] [review]
[PATCH] Fix write_sync_close in case of partial writes.
Comment 3 Stef Walter 2017-02-07 13:17:39 UTC
Great. Thanks. Merged into master.
Comment 4 Jeremy Bicha 2017-02-08 11:23:58 UTC
Created attachment 345185 [details] [review]
Fix write_sync_close in case of partial writes.