# HG changeset patch # User Richard Laager # Date 1200258904 0 # Node ID ac48f2e34359f14220a77410d1df8de25776cfe5 # Parent 85cda171621ae46c75f8bfdb49a21fe116854fa1 Part of a large patch from o_sukhodolsky to fix some build warnings. Refs #1344 I changed this somewhat. If someone cares about QQ, they should really fix the TODO I noted here. diff -r 85cda171621a -r ac48f2e34359 libpurple/protocols/qq/file_trans.c --- a/libpurple/protocols/qq/file_trans.c Sun Jan 13 21:04:47 2008 +0000 +++ b/libpurple/protocols/qq/file_trans.c Sun Jan 13 21:15:04 2008 +0000 @@ -97,6 +97,7 @@ guint8 *buffer; PurpleCipher *cipher; PurpleCipherContext *context; + size_t wc; const gint QQ_MAX_FILE_MD5_LENGTH = 10002432; @@ -109,15 +110,20 @@ buffer = g_newa(guint8, filelen); g_return_if_fail(buffer != NULL); - fread(buffer, filelen, 1, fp); + wc = fread(buffer, filelen, 1, fp); + fclose(fp); + if (wc != 1) { + purple_debug_error("qq", "Unable to read file: %s\n", filename); + + /* TODO: XXX: Really, the caller should be modified to deal with this properly. */ + return; + } cipher = purple_ciphers_find_cipher("md5"); context = purple_cipher_context_new(cipher, NULL); purple_cipher_context_append(context, buffer, filelen); purple_cipher_context_digest(context, 16, md5, NULL); purple_cipher_context_destroy(context); - - fclose(fp); } static void _qq_get_file_header(guint8 *buf, guint8 **cursor, gint buflen, qq_file_header *fh)