pidgin: c72abe62: I'm tired of seeing this warning.

qulogic at pidgin.im qulogic at pidgin.im
Sun Apr 25 17:50:51 EDT 2010


-----------------------------------------------------------------
Revision: c72abe62fc4721161a616a3a477b6a7860495f9f
Ancestor: d890fa889d4f5b828ec9f924223b5676d38daf81
Author: qulogic at pidgin.im
Date: 2010-04-25T21:29:40
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c72abe62fc4721161a616a3a477b6a7860495f9f

Modified files:
        libpurple/protocols/msn/msg.c

ChangeLog: 

I'm tired of seeing this warning.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msg.c	cc85e31a1d1aba5b7a1ed9b76ec7f5350619cd1b
+++ libpurple/protocols/msn/msg.c	6a7f2725f39c442340ec7c2e6ced1cf1a4872ee7
@@ -970,14 +970,13 @@ got_wink_cb(MsnSlpCall *slpcall, const g
 static void 
 got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size)
 {
-	FILE *f;
+	FILE *f = NULL;
 	char *path = NULL;
 	const char *who = slpcall->slplink->remote_user;
 	purple_debug_info("msn", "Received wink from %s\n", who);
 
-	if ((f = purple_mkstemp(&path, TRUE))) {
-		fwrite(data, size, 1, f);
-		fclose(f);
+	if ((f = purple_mkstemp(&path, TRUE)) &&
+	    (fwrite(data, size, 1, f) == size)) {
 		datacast_inform_user(slpcall->slplink->swboard,
 		                     who,
 		                     _("%s sent a wink. <a href='msn-wink://%s'>Click here to play it</a>"),
@@ -988,21 +987,22 @@ got_wink_cb(MsnSlpCall *slpcall, const g
 		                     who,
 		                     _("%s sent a wink, but it could not be saved"),
 		                     NULL);
-	} 
+	}
+	if (f)
+		fclose(f);
 	g_free(path);
 }
 
 static void 
 got_voiceclip_cb(MsnSlpCall *slpcall, const guchar *data, gsize size)
 {
-	FILE *f;
+	FILE *f = NULL;
 	char *path = NULL;
 	const char *who = slpcall->slplink->remote_user;
 	purple_debug_info("msn", "Received voice clip from %s\n", who);
 
-	if ((f = purple_mkstemp(&path, TRUE))) {
-		fwrite(data, size, 1, f);
-		fclose(f);
+	if ((f = purple_mkstemp(&path, TRUE)) &&
+	    (fwrite(data, size, 1, f) == size)) {
 		datacast_inform_user(slpcall->slplink->swboard,
 		                     who,
 		                     _("%s sent a voice clip. <a href='audio://%s'>Click here to play it</a>"),
@@ -1013,7 +1013,9 @@ got_voiceclip_cb(MsnSlpCall *slpcall, co
 		                     who,
 		                     _("%s sent a voice clip, but it could not be saved"),
 		                     NULL);
-	} 
+	}
+	if (f)
+		fclose(f);
 	g_free(path);
 }
 


More information about the Commits mailing list