Commit 2b94f66e authored by Sebastian Harl's avatar Sebastian Harl

Merged branch 'squeeze' into lenny-backports.

parents 4ccf2bb8 7595ebb0
collectd (4.10.1-1+squeeze1) testing-proposed-updates; urgency=medium
* debian/rules:
- Added support for ‘powerpcspe’ to the Java arch mapping; thanks to
Sebastian Andrzej Siewior for the patch (Closes: #592909).
* debian/patches:
- Added bts595756-notify_email-segfault -- upstream patch fixing a
segfault in the 'notify_email' plugin; thanks to Manuel CISSE for
reporting this (Closes: #595756).
- Added bts592623-curl_json-file -- upstream patch fixing access to
file:// URLs in the 'curl_json' plugin; thanks Baptiste Mille-Mathias
for reporting this and pointing out the patch (Closes: #592623).
- Added bts596128-reheap-fix -- upstream patch fixing the 'reheap()'
function used to manage the "read" callbacks and making sure all plugins
get executed correctly and in each interval (Closes: #596128).
* Set urgency to "medium" because of the RC bug-fix.
-- Sebastian Harl <tokkee@debian.org> Sun, 12 Sep 2010 13:53:37 +0200
collectd (4.10.1-1~bpo50+1) lenny-backports; urgency=low
* Rebuild for lenny-backports.
......
rrd_filter_path.dpatch
collection_conf_path.dpatch
bts559801_plugin_find_fix.dpatch
bts595756-notify_email-segfault.dpatch
bts592623-curl_json-file.dpatch
bts596128-reheap-fix.dpatch
#! /bin/sh /usr/share/dpatch/dpatch-run
## bts592623-curl_json-file.dpatch by Florian Forster <octo@verplant.org>
##
## DP: curl json: Fix checking the response code.
## DP:
## DP: This fixes access to file:// URLs.
@DPATCH@
diff a/src/curl_json.c b/src/curl_json.c
--- a/src/curl_json.c
+++ b/src/curl_json.c
@@ -775,7 +775,8 @@ static int cj_curl_perform (cj_t *db, CURL *curl) /* {{{ */
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &rc);
- if (rc != 200)
+ /* The response code is zero if a non-HTTP transport was used. */
+ if ((rc != 0) && (rc != 200))
{
ERROR ("curl_json plugin: curl_easy_perform failed with response code %ld (%s)",
rc, url);
#! /bin/sh /usr/share/dpatch/dpatch-run
## bts595756-notify_email-segfault.dpatch
## by Florian Forster <octo@verplant.org>
##
## DP: notify_email plugin: Serialize all accesses to libesmtp using a mutex.
## DP:
## DP: libesmtp is not thread-safe. This fixes segfaults when accessing the
## DP: plugin in parallel.
@DPATCH@
diff a/src/notify_email.c b/src/notify_email.c
--- a/src/notify_email.c
+++ b/src/notify_email.c
@@ -1,6 +1,7 @@
/**
* collectd - src/notify_email.c
* Copyright (C) 2008 Oleg King
+ * Copyright (C) 2010 Florian Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -18,6 +19,7 @@
*
* Authors:
* Oleg King <king2 at kaluga.ru>
+ * Florian Forster <octo at collectd.org>
**/
#include "collectd.h"
@@ -26,6 +28,7 @@
#include <auth-client.h>
#include <libesmtp.h>
+#include <pthread.h>
#define MAXSTRING 256
@@ -45,6 +48,7 @@ static char **recipients;
static int recipients_len = 0;
static smtp_session_t session;
+static pthread_mutex_t session_lock = PTHREAD_MUTEX_INITIALIZER;
static smtp_message_t message;
static auth_context_t authctx = NULL;
@@ -113,17 +117,23 @@ static int notify_email_init (void)
{
char server[MAXSTRING];
+ ssnprintf(server, sizeof (server), "%s:%i",
+ (smtp_host == NULL) ? DEFAULT_SMTP_HOST : smtp_host,
+ smtp_port);
+
+ pthread_mutex_lock (&session_lock);
+
auth_client_init();
- if (!(session = smtp_create_session ())) {
+
+ session = smtp_create_session ();
+ if (session == NULL) {
+ pthread_mutex_unlock (&session_lock);
ERROR ("notify_email plugin: cannot create SMTP session");
return (-1);
}
smtp_set_monitorcb (session, monitor_cb, NULL, 1);
smtp_set_hostname (session, hostname_g);
- ssnprintf(server, sizeof (server), "%s:%i",
- (smtp_host == NULL) ? DEFAULT_SMTP_HOST : smtp_host,
- smtp_port);
smtp_set_server (session, server);
if (smtp_user && smtp_password) {
@@ -133,18 +143,30 @@ static int notify_email_init (void)
}
if ( !smtp_auth_set_context (session, authctx)) {
+ pthread_mutex_unlock (&session_lock);
ERROR ("notify_email plugin: cannot set SMTP auth context");
return (-1);
}
+ pthread_mutex_unlock (&session_lock);
return (0);
} /* int notify_email_init */
static int notify_email_shutdown (void)
{
- smtp_destroy_session (session);
- auth_destroy_context (authctx);
+ pthread_mutex_lock (&session_lock);
+
+ if (session != NULL)
+ smtp_destroy_session (session);
+ session = NULL;
+
+ if (authctx != NULL)
+ auth_destroy_context (authctx);
+ authctx = NULL;
+
auth_client_exit();
+
+ pthread_mutex_unlock (&session_lock);
return (0);
} /* int notify_email_shutdown */
@@ -248,7 +270,16 @@ static int notify_email_notification (const notification_t *n,
n->host,
n->message);
+ pthread_mutex_lock (&session_lock);
+
+ if (session == NULL) {
+ /* Initialization failed or we're in the process of shutting down. */
+ pthread_mutex_unlock (&session_lock);
+ return (-1);
+ }
+
if (!(message = smtp_add_message (session))) {
+ pthread_mutex_unlock (&session_lock);
ERROR ("notify_email plugin: cannot set SMTP message");
return (-1);
}
@@ -264,6 +295,7 @@ static int notify_email_notification (const notification_t *n,
char buf[MAXSTRING];
ERROR ("notify_email plugin: SMTP server problem: %s",
smtp_strerror (smtp_errno (), buf, sizeof buf));
+ pthread_mutex_unlock (&session_lock);
return (-1);
} else {
const smtp_status_t *status;
@@ -274,6 +306,7 @@ static int notify_email_notification (const notification_t *n,
smtp_enumerate_recipients (message, print_recipient_status, NULL);
}
+ pthread_mutex_unlock (&session_lock);
return (0);
} /* int notify_email_notification */
#! /bin/sh /usr/share/dpatch/dpatch-run
## bts596128-reheap-fix.dpatch by Florian Forster <octo@verplant.org>
##
## DP: src/utils_heap.c: Fix calculation of the parent's index.
## DP:
## DP: This resulted in the "upwards" reheap function to return prematurely,
## DP: leaving the heap condition violated.
@DPATCH@
diff a/src/utils_heap.c b/src/utils_heap.c
--- a/src/utils_heap.c
+++ b/src/utils_heap.c
@@ -96,7 +96,7 @@ static void reheap (c_heap_t *h, size_t root, enum reheap_direction dir)
return;
if (dir == DIR_UP)
- reheap (h, root / 2, dir);
+ reheap (h, (root - 1) / 2, dir);
else if (dir == DIR_DOWN)
reheap (h, min, dir);
} /* void reheap */
@@ -140,6 +140,8 @@ void c_heap_destroy (c_heap_t *h)
int c_heap_insert (c_heap_t *h, void *ptr)
{
+ size_t index;
+
if ((h == NULL) || (ptr == NULL))
return (-EINVAL);
@@ -162,11 +164,12 @@ int c_heap_insert (c_heap_t *h, void *ptr)
}
/* Insert the new node as a leaf. */
- h->list[h->list_len] = ptr;
+ index = h->list_len;
+ h->list[index] = ptr;
h->list_len++;
/* Reorganize the heap from bottom up. */
- reheap (h, /* parent of this node = */ (h->list_len - 1) / 2, DIR_UP);
+ reheap (h, /* parent of this node = */ (index - 1) / 2, DIR_UP);
pthread_mutex_unlock (&h->lock);
return (0);
......@@ -33,7 +33,7 @@ else
endif
# The archdir map has been copied from openjdk-6's debian/rules.
JAVA_ARCHDIR_MAP = armel=arm hppa=parisc lpia=i386 powerpc=ppc sh4=sh
JAVA_ARCHDIR_MAP = armel=arm hppa=parisc lpia=i386 powerpc=ppc powerpcspe=ppc sh4=sh
JAVA_ARCHDIR = $(strip $(patsubst $(DEB_BUILD_ARCH)=%, %, \
$(filter $(DEB_BUILD_ARCH)=%, $(JAVA_ARCHDIR_MAP))))
ifeq (,$(JAVA_ARCHDIR))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment