libpurple/protocols/silc/util.c

changeset 21453
a90cf329cd48
parent 21233
e75de8db4f2b
parent 21389
e1dd8142bb87
child 21503
b3cad646ba4a
--- a/libpurple/protocols/silc/util.c	Sat Nov 10 01:18:15 2007 +0000
+++ b/libpurple/protocols/silc/util.c	Sat Nov 10 04:52:20 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;
 		}
 	}
@@ -218,12 +218,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;
 		}
 	}
@@ -239,7 +239,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;
 		}
@@ -261,7 +261,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;
 				}
@@ -270,12 +270,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;
 		}
 	}
@@ -347,8 +347,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)

mercurial