[Goodies-commits] r5926 - in xfce4-sensors-plugin/trunk: . lib

Fabian Nowak timystery at xfce.org
Sun Nov 2 23:30:30 CET 2008


Author: timystery
Date: 2008-11-02 22:30:30 +0000 (Sun, 02 Nov 2008)
New Revision: 5926

Modified:
   xfce4-sensors-plugin/trunk/configure.in.in
   xfce4-sensors-plugin/trunk/lib/hddtemp.c
Log:
minor modifications to netcat handling


Modified: xfce4-sensors-plugin/trunk/configure.in.in
===================================================================
--- xfce4-sensors-plugin/trunk/configure.in.in	2008-11-02 21:53:46 UTC (rev 5925)
+++ xfce4-sensors-plugin/trunk/configure.in.in	2008-11-02 22:30:30 UTC (rev 5926)
@@ -153,6 +153,8 @@
     HDDTEMP_PORT=7634
     AC_DEFINE_UNQUOTED([HDDTEMP_PORT], ["$HDDTEMP_PORT"], [Port for hddtemp with netcat])
     AC_SUBST([HDDTEMP_PORT])
+
+
 fi
 
 AM_CONDITIONAL([HAVE__NETCAT], [test x$enable_netcat = x"yes"])

Modified: xfce4-sensors-plugin/trunk/lib/hddtemp.c
===================================================================
--- xfce4-sensors-plugin/trunk/lib/hddtemp.c	2008-11-02 21:53:46 UTC (rev 5925)
+++ xfce4-sensors-plugin/trunk/lib/hddtemp.c	2008-11-02 22:30:30 UTC (rev 5926)
@@ -457,30 +457,33 @@
     result = g_spawn_command_line_sync ( (const gchar*) cmd_line,
             &standard_output, &standard_error, &exit_status, NULL);
     error = g_new(GError, 1);
-    tmp3 = "-255";
-    tmp = str_split (standard_output, DOUBLE_DELIMITER);
-    do {
-        //g_printf ("Found token: %s for disk %s\n", tmp, disk);
-        tmp2 = g_strdup (tmp);
-        tmp3 = strtok (tmp2, SINGLE_DELIMITER); // device name
-        if (strcmp(tmp3, disk)==0)
-        {
-            tmp3 = strtok(NULL, SINGLE_DELIMITER); // name
-            tmp3 = strdup(strtok(NULL, SINGLE_DELIMITER)); // value
-            // tmp3 = strtok(NULL, SINGLE_DELIMITER); // temperature unit
-            exit_status = 0;
-            g_free(error);
-            error = NULL;
+    if (exit_status==0)
+    {
+        tmp3 = "-255";
+        tmp = str_split (standard_output, DOUBLE_DELIMITER);
+        do {
+            //g_printf ("Found token: %s for disk %s\n", tmp, disk);
+            tmp2 = g_strdup (tmp);
+            tmp3 = strtok (tmp2, SINGLE_DELIMITER); // device name
+            if (strcmp(tmp3, disk)==0)
+            {
+                tmp3 = strtok(NULL, SINGLE_DELIMITER); // name
+                tmp3 = strdup(strtok(NULL, SINGLE_DELIMITER)); // value
+                // tmp3 = strtok(NULL, SINGLE_DELIMITER); // temperature unit
+                exit_status = 0;
+                g_free(error);
+                error = NULL;
+                g_free (tmp2);
+                break;
+            }
             g_free (tmp2);
-            break;
         }
-        g_free (tmp2);
+        while ( (tmp = str_split(NULL, DOUBLE_DELIMITER)) );
+
+        g_free(standard_output);
+        standard_output = tmp3;
     }
-    while ( (tmp = str_split(NULL, DOUBLE_DELIMITER)) );
 
-    g_free(standard_output);
-    standard_output = tmp3;
-
 #else
     error = NULL;
     cmd_line = g_strdup_printf ( "%s -n -q %s", PATH_HDDTEMP, disk);




More information about the Goodies-commits mailing list