[balsa/gtk3] Seek before writing to stream



commit 91c0c3d22b018daca501a7e20e7f3c26dcab3e9d
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jul 15 22:24:32 2012 -0400

    Seek before writing to stream
    
    	* libbalsa/address-book-ldif.c
    	(libbalsa_address_book_ldif_save_address): fseek before writing
    	to stream.

 ChangeLog                    |    6 ++++++
 libbalsa/address-book-ldif.c |    4 +++-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f6aeff7..cd86a0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2012-07-15  Peter Bloomfield
 
+	* libbalsa/address-book-ldif.c
+	(libbalsa_address_book_ldif_save_address): fseek before writing
+	to stream.
+
+2012-07-15  Peter Bloomfield
+
 	* libbalsa/imap/imap_compress.c (imap_compress_init): memset
 	size of struct, not size of pointer to struct.
 
diff --git a/libbalsa/address-book-ldif.c b/libbalsa/address-book-ldif.c
index 6a1b027..54cb746 100644
--- a/libbalsa/address-book-ldif.c
+++ b/libbalsa/address-book-ldif.c
@@ -588,8 +588,10 @@ libbalsa_address_book_ldif_save_address(FILE * stream,
                                         LibBalsaAddress * address)
 {
     if (fseek(stream, -2, SEEK_END) == 0
-        && (fgetc(stream) != '\n' || fgetc(stream) != '\n'))
+        && (fgetc(stream) != '\n' || fgetc(stream) != '\n')) {
+        fseek(stream, 0, SEEK_END);
         fputc('\n', stream);
+    }
 
     lbab_ldif_write_dn(stream, address);
     lbab_ldif_write_givenname(stream, address);



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