[Commits] mailmbox.c 1.3.2.3 1.3.2.4

claws at claws-mail.org claws at claws-mail.org
Sun Jul 15 06:11:00 CEST 2012


Update of /home/claws-mail/plugins/mailmbox/src
In directory srv:/tmp/cvs-serv25578/src

Modified Files:
      Tag: gtk2
	mailmbox.c 
Log Message:
2012-07-15 [paul]	1.14.7cvs3

	* src/mailmbox.c
		fix bug 2687, 'Unable to clean an mbox mailbox'
		Patch by pv4 at bk.ru. 

Index: mailmbox.c
===================================================================
RCS file: /home/claws-mail/plugins/mailmbox/src/mailmbox.c,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -d -r1.3.2.3 -r1.3.2.4
--- mailmbox.c	10 Feb 2010 07:39:45 -0000	1.3.2.3
+++ mailmbox.c	15 Jul 2012 04:10:58 -0000	1.3.2.4
@@ -1183,10 +1183,12 @@
     goto err;
   }
 
-  dest = (char *) mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, dest_fd, 0);
-  if (dest == MAP_FAILED) {
-    res = MAILMBOX_ERROR_FILE;
-    goto err;
+  if (size) {
+    dest = (char *) mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, dest_fd, 0);
+    if (dest == MAP_FAILED) {
+      res = MAILMBOX_ERROR_FILE;
+      goto err;
+    }
   }
 
   cur_offset = 0;
@@ -1228,9 +1230,11 @@
     }
   }
   fflush(stdout);
-  
-  msync(dest, size, MS_SYNC);
-  munmap(dest, size);
+
+  if (size) {
+    msync(dest, size, MS_SYNC);
+    munmap(dest, size);
+  }
 
   * result_size = size;
 



More information about the Commits mailing list