[evolution-patches] [mail] Patch to close stray fds - bug#307375



Hi,

There are some file descriptors which needed to be closed. Attached
patch for the same.
There was one such case in em-composer-prefs.c which I have corrected in
the cvs. On a second check, three more cases surfaced, so please see if
it is okay to commit ?
The related bug is #307375. 
Thanks,
Kaushal
? mail/Evolution-Mail-common.c
? mail/Evolution-Mail-skels.c
? mail/Evolution-Mail-stubs.c
? mail/Evolution-Mail.h
? mail/evolution-mail-2.4.schemas
? mail/mail.error
? mail/default/zh_CN/Makefile
? mail/default/zh_CN/Makefile.in
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3697
diff -p -u -5 -r1.3697 ChangeLog
--- mail/ChangeLog	17 Aug 2005 07:35:38 -0000	1.3697
+++ mail/ChangeLog	17 Aug 2005 09:25:41 -0000
@@ -1,7 +1,14 @@
 2005-08-17  Kaushal Kumar  <kakumar novell com>
 
+	* em-utils.c (em_utils_selection_set_urilist), 
+	(em_utils_selection_get_urilist): Close the file descriptor.
+
+	* mail-ops.c (save_messages_save): ditto.
+
+2005-08-17  Kaushal Kumar  <kakumar novell com>
+
 	* em-composer-prefs.c (url_requested): Add the close call for fd.
 
 	See bug #307375.
 
 2005-08-15  Not Zed  <NotZed Ximian com>
Index: mail/em-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-utils.c,v
retrieving revision 1.67
diff -p -u -5 -r1.67 em-utils.c
--- mail/em-utils.c	7 Aug 2005 21:18:18 -0000	1.67
+++ mail/em-utils.c	17 Aug 2005 09:25:41 -0000
@@ -1161,10 +1161,11 @@ em_utils_selection_set_urilist(GtkSelect
 		if (em_utils_write_messages_to_stream(folder, uids, fstream) == 0)
 			gtk_selection_data_set(data, data->target, 8, uri, strlen(uri));
 
 		camel_object_unref(fstream);
 	}
+	close (fd);
 }
 
 /**
  * em_utils_selection_set_urilist:
  * @data: 
@@ -1200,10 +1201,11 @@ em_utils_selection_get_urilist(GtkSelect
 		if (strcmp(url->protocol, "file") == 0
 		    && (fd = open(url->path, O_RDONLY)) != -1) {
 			stream = camel_stream_fs_new_with_fd(fd);
 			res = em_utils_read_messages_from_stream(folder, stream);
 			camel_object_unref(stream);
+			close (fd);
 		}
 		camel_url_free(url);
 	}
 
 	g_strfreev(uris);
Index: mail/mail-ops.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.c,v
retrieving revision 1.451
diff -p -u -5 -r1.451 mail-ops.c
--- mail/mail-ops.c	10 Aug 2005 02:04:31 -0000	1.451
+++ mail/mail-ops.c	17 Aug 2005 09:25:42 -0000
@@ -2023,10 +2023,11 @@ save_messages_save (struct _mail_msg *mm
 		camel_object_unref(message);
 	}
 
 	camel_object_unref(filtered_stream);
 	camel_object_unref(stream);
+	close (fd);
 }
 
 static void save_messages_saved(struct _mail_msg *mm)
 {
 	struct _save_messages_msg *m = (struct _save_messages_msg *)mm;


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