evolution-data-server r8769 - trunk/camel



Author: fejj
Date: Wed May  7 19:30:16 2008
New Revision: 8769
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8769&view=rev

Log:
2008-05-07  Jeffrey Stedfast  <fejj novell com>

	* camel-uid-cache.c (camel_uid_cache_save): Check cache->fd after
	we finish looping thru all of our uids; if cache->fd is -1, then
	it means we failed somewhere along the lines and need to goto
	exception.



Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-uid-cache.c

Modified: trunk/camel/camel-uid-cache.c
==============================================================================
--- trunk/camel/camel-uid-cache.c	(original)
+++ trunk/camel/camel-uid-cache.c	Wed May  7 19:30:16 2008
@@ -169,7 +169,7 @@
 	cache->expired = 0;
 	g_hash_table_foreach (cache->uids, maybe_write_uid, cache);
 	
-	if (fsync (fd) == -1)
+	if (cache->fd == -1 || fsync (fd) == -1)
 		goto exception;
 	
 	close (fd);
@@ -207,13 +207,19 @@
 		if (g_stat (cache->filename, &st) == 0 &&
 		    (cache->size > st.st_size || cache->size + cache->expired > st.st_size)) {
 			if (ftruncate (fd, (off_t) cache->size) != -1) {
-				cache->size = 0;
+				close (fd);
+				g_rename (filename, cache->filename);
+				g_free (filename);
 				cache->expired = 0;
-				goto overwrite; /* FIXME: no such label */
+				cache->size = 0;
+				cache->fd = -1;
+				
+				return TRUE;
 			}
 		}		
 	}
 #endif
+	
 	if (fd != -1) {
 		close (fd);
 		cache->fd = -1;



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