summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-10-27 08:52:20 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-10-27 08:52:20 +0200
commit3f067f206552aa9fa9f30df6e6432cc0fa92766d (patch)
tree6a808a3fb510ced631afb27775446993c9bc5d93 /src
parenta6a90aebffe494676a77e36eda0a7c9340e2eee9 (diff)
downloadweechat-3f067f206552aa9fa9f30df6e6432cc0fa92766d.zip
buflist: fix warning displayed when script buffers.pl is loaded (closes #1274)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/buflist/buflist.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c
index bdc8aea76..79459c6d6 100644
--- a/src/plugins/buflist/buflist.c
+++ b/src/plugins/buflist/buflist.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <libgen.h>
#include "../weechat-plugin.h"
#include "buflist.h"
@@ -363,7 +364,7 @@ int
buflist_script_loaded_cb (const void *pointer, void *data, const char *signal,
const char *type_data, void *signal_data)
{
- int length;
+ char *base_name, *base_name2;
/* make C compiler happy */
(void) pointer;
@@ -378,9 +379,14 @@ buflist_script_loaded_cb (const void *pointer, void *data, const char *signal,
if (!signal_data)
return WEECHAT_RC_OK;
- length = strlen (signal_data);
- if ((length >= 10)
- && (strncmp (signal_data + length - 10, "buffers.pl", 10) == 0))
+ base_name = basename (signal_data);
+ if (!base_name)
+ return WEECHAT_RC_OK;
+ base_name2 = strdup (base_name);
+ if (!base_name2)
+ return WEECHAT_RC_OK;
+
+ if (strcmp (base_name2, "buffers.pl") == 0)
{
weechat_printf (NULL,
_("%sbuflist: warning: the script buffers.pl is "
@@ -393,6 +399,8 @@ buflist_script_loaded_cb (const void *pointer, void *data, const char *signal,
weechat_prefix ("error"));
}
+ free (base_name2);
+
return WEECHAT_RC_OK;
}