hddtemp plugin: Prefix all messages with "hddtemp plugin:".
authorFlorian Forster <octo@huhu.verplant.org>
Mon, 31 Mar 2008 06:29:25 +0000 (08:29 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Mon, 31 Mar 2008 06:29:25 +0000 (08:29 +0200)
src/hddtemp.c

index 1047077..09f6bbe 100644 (file)
@@ -120,7 +120,7 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size)
        if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0)
        {
                char errbuf[1024];
-               ERROR ("hddtemp: getaddrinfo (%s, %s): %s",
+               ERROR ("hddtemp plugin: getaddrinfo (%s, %s): %s",
                                host, port,
                                (ai_return == EAI_SYSTEM)
                                ? sstrerror (errno, errbuf, sizeof (errbuf))
@@ -132,19 +132,23 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size)
        for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
        {
                /* create our socket descriptor */
-               if ((fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol)) < 0)
+               fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype,
+                               ai_ptr->ai_protocol);
+               if (fd < 0)
                {
                        char errbuf[1024];
-                       ERROR ("hddtemp: socket: %s",
+                       ERROR ("hddtemp plugin: socket: %s",
                                        sstrerror (errno, errbuf, sizeof (errbuf)));
                        continue;
                }
 
                /* connect to the hddtemp daemon */
-               if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen))
+               if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr,
+                                       ai_ptr->ai_addrlen))
                {
                        char errbuf[1024];
-                       INFO ("hddtemp: connect (%s, %s): %s", host, port,
+                       INFO ("hddtemp plugin: connect (%s, %s) failed: %s",
+                                       host, port,
                                        sstrerror (errno, errbuf, sizeof (errbuf)));
                        close (fd);
                        fd = -1;
@@ -160,7 +164,7 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size)
 
        if (fd < 0)
        {
-               ERROR ("hddtemp: Could not connect to daemon.");
+               ERROR ("hddtemp plugin: Could not connect to daemon.");
                return (-1);
        }
 
@@ -177,7 +181,7 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size)
                        if ((errno == EAGAIN) || (errno == EINTR))
                                continue;
 
-                       ERROR ("hddtemp: Error reading from socket: %s",
+                       ERROR ("hddtemp plugin: Error reading from socket: %s",
                                        sstrerror (errno, errbuf, sizeof (errbuf)));
                        close (fd);
                        return (-1);
@@ -191,12 +195,13 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size)
        if (buffer_fill >= buffer_size)
        {
                buffer[buffer_size - 1] = '\0';
-               WARNING ("hddtemp: Message from hddtemp has been truncated.");
+               WARNING ("hddtemp plugin: Message from hddtemp has been "
+                               "truncated.");
        }
        else if (buffer_fill == 0)
        {
-               WARNING ("hddtemp: Peer has unexpectedly shut down the socket. "
-                               "Buffer: `%s'", buffer);
+               WARNING ("hddtemp plugin: Peer has unexpectedly shut down "
+                               "the socket. Buffer: `%s'", buffer);
                close (fd);
                return (-1);
        }
@@ -263,7 +268,7 @@ static int hddtemp_init (void)
 
        if ((fh = fopen ("/proc/partitions", "r")) != NULL)
        {
-               DEBUG ("Looking at /proc/partitions...");
+               DEBUG ("hddtemp plugin: Looking at /proc/partitions...");
 
                while (fgets (buf, sizeof (buf), fh) != NULL)
                {
@@ -339,25 +344,25 @@ static int hddtemp_init (void)
 
                                /* Skip all other majors. */
                                default:
-                                       DEBUG ("Skipping unknown major %i", major);
+                                       DEBUG ("hddtemp plugin: Skipping unknown major %i", major);
                                        continue;
                        } /* switch (major) */
 
                        if ((name = strdup (fields[3])) == NULL)
                        {
-                               ERROR ("hddtemp: strdup(%s) == NULL", fields[3]);
+                               ERROR ("hddtemp plugin: strdup(%s) == NULL", fields[3]);
                                continue;
                        }
 
                        if ((entry = (hddname_t *) malloc (sizeof (hddname_t))) == NULL)
                        {
-                               ERROR ("hddtemp: malloc (%u) == NULL",
+                               ERROR ("hddtemp plugin: malloc (%u) == NULL",
                                                (unsigned int) sizeof (hddname_t));
                                free (name);
                                continue;
                        }
 
-                       DEBUG ("Found disk: %s (%u:%u).", name, major, minor);
+                       DEBUG ("hddtemp plugin: Found disk: %s (%u:%u).", name, major, minor);
 
                        entry->major = major;
                        entry->minor = minor;
@@ -380,7 +385,7 @@ static int hddtemp_init (void)
        else
        {
                char errbuf[1024];
-               DEBUG ("Could not open /proc/partitions: %s",
+               DEBUG ("hddtemp plugin: Could not open /proc/partitions: %s",
                                sstrerror (errno, errbuf, sizeof (errbuf)));
        }
 #endif /* COLLECT_DEBUG */
@@ -408,7 +413,7 @@ static char *hddtemp_get_name (char *drive)
 
        if (list == NULL)
        {
-               DEBUG ("Don't know %s, keeping name as-is.", drive);
+               DEBUG ("hddtemp plugin: Don't know %s, keeping name as-is.", drive);
                return (strdup (drive));
        }