changeset 14086:545dbc931e8c

[gaim-migrate @ 16709] Deal with inability to create key pair. (CID 139) committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 11 Aug 2006 19:02:47 +0000
parents 682394f005dd
children c28883e918f0
files src/protocols/silc/util.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/silc/util.c	Fri Aug 11 18:35:26 2006 +0000
+++ b/src/protocols/silc/util.c	Fri Aug 11 19:02:47 2006 +0000
@@ -205,12 +205,20 @@
 		/* If file doesn't exist */
 		if (errno == ENOENT) {
 			gaim_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5);
-			silc_create_key_pair(SILCGAIM_DEF_PKCS,
+			if (!silc_create_key_pair(SILCGAIM_DEF_PKCS,
 					     SILCGAIM_DEF_PKCS_LEN,
 					     file_public_key, file_private_key, NULL,
 					     (gc->password == NULL) ? "" : gc->password,
-						 NULL, NULL, NULL, FALSE);
-			g_stat(file_public_key, &st);
+						 NULL, NULL, NULL, FALSE)) {
+				gaim_debug_error("silc", "Couldn't create key pair\n");
+				return FALSE;
+			}
+
+			if ((g_stat(file_public_key, &st)) == -1) {
+				gaim_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n",
+					file_public_key, strerror(errno));
+				return FALSE;
+			}
 		} else {
 			gaim_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n",
 							 file_public_key, strerror(errno));