1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 09:43:13 +02:00

Fixed crash when loading ruby script if file does not exist, with Ruby >= 1.9 only (bug #18064)

This commit is contained in:
Sebastien Helleu
2006-10-20 09:19:51 +00:00
parent 06c4cf4144
commit a3878a522c
10 changed files with 66 additions and 22 deletions
+12 -1
View File
@@ -32,6 +32,8 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "../../weechat-plugin.h"
#include "../weechat-script.h"
@@ -1796,10 +1798,19 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
char modname[64];
VALUE curModule, ruby_retcode, err;
int ruby_error;
struct stat buf;
plugin->print_server (plugin, "Loading Ruby script \"%s\"", filename);
if (stat (filename, &buf) != 0)
{
plugin->print_server (plugin, "Ruby error: script \"%s\" not found",
filename);
return 0;
}
ruby_current_script = NULL;
snprintf(modname, sizeof(modname), "%s%d", MOD_NAME_PREFIX, ruby_num);
ruby_num++;