Merge branch 'ff/java'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 28 Feb 2009 09:35:58 +0000 (10:35 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 28 Feb 2009 09:35:58 +0000 (10:35 +0100)
contrib/oracle/create_schema.ddl
src/collectd-unixsock.pod
src/common.c
src/dns.c
src/oracle.c

index e4dc54f..86b1e83 100644 (file)
@@ -1,3 +1,22 @@
+-- collectd - contrib/oracle/create_schema.ddl
+-- Copyright (C) 2008,2009  Roman Klesel
+--
+-- 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
+-- Free Software Foundation; only version 2 of the License is applicable.
+--
+-- This program is distributed in the hope that it will be useful, but
+-- WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-- General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along
+-- with this program; if not, write to the Free Software Foundation, Inc.,
+-- 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+--
+-- Authors:
+--   Roman Klesel <roman.klesel at noris.de>
+
 -- Description
 --------------
 -- This will create a schema to provide collectd with the required permissions
@@ -241,3 +260,5 @@ END;
 
 spool off
 quit
+
+-- vim: set syntax=sql :
index ca00a6d..ac4a1b1 100644 (file)
@@ -17,11 +17,11 @@ collectd-unixsock - Documentation of collectd's C<unixsock plugin>
 
 The C<unixsock plugin> opens an UNIX-socket over which one can interact with
 the daemon. This can be used to use the values collected by collectd in other
-applications, such as monitoring, or submit externally collected values to
-collectd.
+applications, such as monitoring solutions, or submit externally collected
+values to collectd.
 
-This plugin is used by L<collectd-nagios(1)> to check if some value is in a
-certain range and exit with a Nagios-compatible exit code.
+For example, this plugin is used by L<collectd-nagios(1)> to check if some
+value is in a certain range and exit with a Nagios-compatible exit code.
 
 =head1 COMMANDS
 
index 4aa0ebe..ef80885 100644 (file)
@@ -516,7 +516,8 @@ int check_create_dir (const char *file_orig)
                 */
                if (fields[i][0] == '.')
                {
-                       ERROR ("Cowardly refusing to create a directory that begins with a `.' (dot): `%s'", file_orig);
+                       ERROR ("Cowardly refusing to create a directory that "
+                                       "begins with a `.' (dot): `%s'", file_orig);
                        return (-2);
                }
 
@@ -531,32 +532,42 @@ int check_create_dir (const char *file_orig)
                        return (-1);
                }
 
-               if (stat (dir, &statbuf) == -1)
-               {
-                       if (errno == ENOENT)
+               while (42) {
+                       if (stat (dir, &statbuf) == -1)
                        {
-                               if (mkdir (dir, 0755) == -1)
+                               if (errno == ENOENT)
                                {
+                                       if (mkdir (dir, 0755) == 0)
+                                               break;
+
+                                       /* this might happen, if a different thread created
+                                        * the directory in the meantime
+                                        * => call stat() again to check for S_ISDIR() */
+                                       if (EEXIST == errno)
+                                               continue;
+
                                        char errbuf[1024];
                                        ERROR ("check_create_dir: mkdir (%s): %s", dir,
                                                        sstrerror (errno,
                                                                errbuf, sizeof (errbuf)));
                                        return (-1);
                                }
+                               else
+                               {
+                                       char errbuf[1024];
+                                       ERROR ("check_create_dir: stat (%s): %s", dir,
+                                                       sstrerror (errno, errbuf,
+                                                               sizeof (errbuf)));
+                                       return (-1);
+                               }
                        }
-                       else
+                       else if (!S_ISDIR (statbuf.st_mode))
                        {
-                               char errbuf[1024];
-                               ERROR ("stat (%s): %s", dir,
-                                               sstrerror (errno, errbuf,
-                                                       sizeof (errbuf)));
+                               ERROR ("check_create_dir: `%s' exists but is not "
+                                               "a directory!", dir);
                                return (-1);
                        }
-               }
-               else if (!S_ISDIR (statbuf.st_mode))
-               {
-                       ERROR ("stat (%s): Not a directory!", dir);
-                       return (-1);
+                       break;
                }
        }
 
index ab38789..476b6dd 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -212,7 +212,7 @@ static void *dns_child_loop (void __attribute__((unused)) *dummy)
 
        /* Passing `pcap_device == NULL' is okay and the same as passign "any" */
        DEBUG ("Creating PCAP object..");
-       pcap_obj = pcap_open_live (pcap_device,
+       pcap_obj = pcap_open_live ((pcap_device != NULL) ? pcap_device : "any",
                        PCAP_SNAPLEN,
                        0 /* Not promiscuous */,
                        interval_g,
index 324dd4b..78a09ff 100644 (file)
@@ -497,7 +497,7 @@ static int o_read_database_query (o_database_t *db, /* {{{ */
   for (i = 0; i < column_num; i++) /* {{{ */
   {
     char *column_name;
-    size_t column_name_length;
+    ub4 column_name_length;
     OCIParam *oci_param;
 
     oci_param = NULL;
@@ -533,8 +533,8 @@ static int o_read_database_query (o_database_t *db, /* {{{ */
     column_names[i][column_name_length] = 0;
 
     DEBUG ("oracle plugin: o_read_database_query: column_names[%zu] = %s; "
-        "column_name_length = %zu;",
-        i, column_names[i], column_name_length);
+        "column_name_length = %"PRIu32";",
+        i, column_names[i], (uint32_t) column_name_length);
 
     status = OCIDefineByPos (oci_statement,
         &oci_defines[i], oci_error, (ub4) (i + 1),