pidgin: 4f5a1628: Add error handling for visiblity to why ...

datallah at pidgin.im datallah at pidgin.im
Wed Jul 30 00:55:43 EDT 2008


-----------------------------------------------------------------
Revision: 4f5a162830145daaa19e12d05650305e88df5a9d
Ancestor: 26c81584e7a0c9b9cc1a1cd58a9d7822aa63f43e
Author: datallah at pidgin.im
Date: 2008-07-30T04:51:58
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4f5a162830145daaa19e12d05650305e88df5a9d

Modified files:
        libpurple/plugins/perl/perl.c

ChangeLog: 

Add error handling for visiblity to why Perl plugins fail to load.
Fixes #240

-------------- next part --------------
============================================================
--- libpurple/plugins/perl/perl.c	0bf5d2c08b10aaf860740cf62ec47bd890d0afd1
+++ libpurple/plugins/perl/perl.c	82362342ad09a0397de6e6e9574f6ceebe772c86
@@ -251,7 +251,7 @@ probe_perl_plugin(PurplePlugin *plugin)
 
 	char *args[] = {"", plugin->path };
 	char **argv = args;
-	int argc = 2;
+	int argc = 2, ret;
 	PerlInterpreter *prober;
 	gboolean status = TRUE;
 	HV *plugin_info;
@@ -285,10 +285,30 @@ probe_perl_plugin(PurplePlugin *plugin)
 }
 #endif
 
-	perl_parse(prober, xs_init, argc, argv, NULL);
+	ret = perl_parse(prober, xs_init, argc, argv, NULL);
 
-	perl_run(prober);
+	if (ret != 0) {
+		STRLEN len;
+		const char * errmsg = "Unknown error";
+		if (SvTRUE(ERRSV))
+			errmsg = SvPV(ERRSV, len);
+		purple_debug_error("perl", "Unable to parse plugin %s (%d:%s)\n",
+						   plugin->path, ret, errmsg);
+		goto cleanup;
+	}
 
+	ret = perl_run(prober);
+
+	if (ret != 0) {
+		STRLEN len;
+		const char * errmsg = "Unknown error";
+		if (SvTRUE(ERRSV))
+			errmsg = SvPV(ERRSV, len);
+		purple_debug_error("perl", "Unable to run perl interpreter on plugin %s (%d:%s)\n",
+						   plugin->path, ret, errmsg);
+		goto cleanup;
+	}
+
 	plugin_info = perl_get_hv("PLUGIN_INFO", FALSE);
 
 	if (plugin_info == NULL)
@@ -435,6 +455,7 @@ probe_perl_plugin(PurplePlugin *plugin)
 		}
 	}
 
+	cleanup:
 	PL_perl_destruct_level = 1;
 	PERL_SET_CONTEXT(prober);
 	perl_destruct(prober);


More information about the Commits mailing list