diff libpurple/protocols/silc/util.c @ 21418:38cc722159ff

propagate from branch 'im.pidgin.pidgin' (head d8103be97302efb404e2f6922925f661c807ad23) to branch 'im.pidgin.cpw.resiak.disconnectreason' (head 0ac25a1f38ae28654c967caa143f1c0d12ef2e1c)
author Will Thompson <will.thompson@collabora.co.uk>
date Sat, 10 Nov 2007 12:10:04 +0000
parents e747ac0c42d6 6de09629f091
children 665e04562de0
line wrap: on
line diff
--- a/libpurple/protocols/silc/util.c	Wed Nov 07 11:23:03 2007 +0000
+++ b/libpurple/protocols/silc/util.c	Sat Nov 10 12:10:04 2007 +0000
@@ -79,7 +79,7 @@
 
 	pw = getpwuid(getuid());
 	if (!pw) {
-		purple_debug_error("silc", "silc: %s\n", strerror(errno));
+		purple_debug_error("silc", "silc: %s\n", g_strerror(errno));
 		return FALSE;
 	}
 
@@ -108,7 +108,7 @@
 				return FALSE;
 			}
 		} else {
-			purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, strerror(errno));
+			purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, g_strerror(errno));
 			return FALSE;
 		}
 	} else {
@@ -140,7 +140,7 @@
 			}
 		} else {
 			purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n",
-							 servfilename, strerror(errno));
+							 servfilename, g_strerror(errno));
 			return FALSE;
 		}
 	}
@@ -163,7 +163,7 @@
 			}
 		} else {
 			purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n",
-							 clientfilename, strerror(errno));
+							 clientfilename, g_strerror(errno));
 			return FALSE;
 		}
 	}
@@ -186,7 +186,7 @@
 			}
 		} else {
 			purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n",
-							 friendsfilename, strerror(errno));
+							 friendsfilename, g_strerror(errno));
 			return FALSE;
 		}
 	}
@@ -219,12 +219,12 @@
 
 			if ((g_stat(file_public_key, &st)) == -1) {
 				purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n",
-						   file_public_key, strerror(errno));
+						   file_public_key, g_strerror(errno));
 				return FALSE;
 			}
 		} else {
 			purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n",
-					   file_public_key, strerror(errno));
+					   file_public_key, g_strerror(errno));
 			return FALSE;
 		}
 	}
@@ -240,7 +240,7 @@
 	if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) {
 		if ((fstat(fd, &st)) == -1) {
 			purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
-					   file_private_key, strerror(errno));
+					   file_private_key, g_strerror(errno));
 			close(fd);
 			return FALSE;
 		}
@@ -263,7 +263,7 @@
 			if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) {
 				if ((fstat(fd, &st)) == -1) {
 					purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
-							   file_private_key, strerror(errno));
+							   file_private_key, g_strerror(errno));
 					close(fd);
 					return FALSE;
 				}
@@ -272,12 +272,12 @@
 			 * will set the permissions */
 			else if ((g_stat(file_private_key, &st)) == -1) {
 				purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
-						   file_private_key, strerror(errno));
+						   file_private_key, g_strerror(errno));
 				return FALSE;
 			}
 		} else {
 			purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
-					   file_private_key, strerror(errno));
+					   file_private_key, g_strerror(errno));
 			return FALSE;
 		}
 	}
@@ -349,8 +349,12 @@
 	key_len = silc_pkcs_public_key_get_len(public_key);
 
 	pk = silc_pkcs_public_key_encode(public_key, &pk_len);
+	if (!pk)
+	  return;
 	fingerprint = silc_hash_fingerprint(NULL, pk, pk_len);
 	babbleprint = silc_hash_babbleprint(NULL, pk, pk_len);
+	if (!fingerprint || !babbleprint)
+	  return;
 
 	s = g_string_new("");
 	if (ident->realname)