[gnome-keyring] Fix write_sync_close in case of partial writes.



commit d927f252d5a9181b27b3061f83d6fdf53fa64bdc
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Tue Feb 7 11:26:10 2017 +0100

    Fix write_sync_close in case of partial writes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778269

 pkcs11/gkm/gkm-transaction.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/pkcs11/gkm/gkm-transaction.c b/pkcs11/gkm/gkm-transaction.c
index df74871..c5f8ddd 100644
--- a/pkcs11/gkm/gkm-transaction.c
+++ b/pkcs11/gkm/gkm-transaction.c
@@ -347,8 +347,12 @@ write_sync_close (int fd, const guchar *data, gsize n_data)
                                close (fd);
                                return FALSE;
                        }
+                       continue;
                }
-               n_data -= MAX (res, n_data);
+               g_assert (res <= n_data);
+
+               data += res;
+               n_data -= res;
        }
 
 #ifdef HAVE_FSYNC


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]