changeset 10102:0f1c25270121

[gaim-migrate @ 11127] This fixes a crash trying to send a file on MSN if you can't actually read the file you're trying to send. Someone reported this in #gaim, I hope it fixes some bugs in the tracker too. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 15 Oct 2004 18:44:05 +0000
parents 6cbeca0e8f58
children a9521c791afe
files src/protocols/msn/msn.c
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Fri Oct 15 03:34:12 2004 +0000
+++ b/src/protocols/msn/msn.c	Fri Oct 15 18:44:05 2004 +0000
@@ -351,9 +351,34 @@
 t_msn_xfer_init(GaimXfer *xfer)
 {
 	MsnSlpLink *slplink;
+	const char *filename;
+	FILE *fp;
+
+	filename = gaim_xfer_get_local_filename(xfer);
 
 	slplink = xfer->data;
 
+	if ((fp = fopen(filename, "rb")) == NULL)
+	{
+		GaimAccount *account;
+		GaimConnection *gc;
+		const char *who;
+		char *msg;
+
+		account = slplink->session->account;
+		gc = gaim_account_get_connection(account);
+		who = slplink->remote_user;
+
+		msg = g_strdup_printf(_("Error reading %s: \n%s.\n"),
+							  filename, strerror(errno));
+		gaim_xfer_error(gaim_xfer_get_type(xfer), who, msg);
+		gaim_xfer_cancel_local(xfer);
+		g_free(msg);
+
+		return;
+	}
+	fclose(fp);
+
 	msn_slplink_request_ft(slplink, xfer);
 }