Merge branch 'collectd-4.7' into collectd-4.8
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 10 Nov 2009 19:17:36 +0000 (20:17 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 10 Nov 2009 19:17:36 +0000 (20:17 +0100)
Conflicts:
src/snmp.c

1  2 
src/Makefile.am
src/rrdcached.c
src/snmp.c

diff --cc src/Makefile.am
Simple merge
diff --cc src/rrdcached.c
Simple merge
diff --cc src/snmp.c
@@@ -783,45 -793,25 +786,47 @@@ static value_t csnmp_value_list_to_valu
        }
      }
  
 -    /* Check if an error occurred */
 -    if ((vl->val.string == NULL) || (endptr == (char *) vl->val.string))
 +    if (status != 0)
      {
 -      if (type == DS_TYPE_COUNTER)
 -      ret.counter = 0;
 -      else if (type == DS_TYPE_GAUGE)
 -      ret.gauge = NAN;
 +      switch (type)
 +      {
 +      case DS_TYPE_COUNTER:
 +      case DS_TYPE_DERIVE:
 +      case DS_TYPE_ABSOLUTE:
 +        memset (&ret, 0, sizeof (ret));
 +        break;
 +
 +      case DS_TYPE_GAUGE:
 +        ret.gauge = NAN;
 +        break;
 +
 +      default:
 +        ERROR ("snmp plugin: csnmp_value_list_to_value: Unknown "
 +            "data source type: %i.", type);
 +        ret.gauge = NAN;
 +      }
      }
 -  }
 +  } /* if (vl->type == ASN_OCTET_STR) */
    else if (type == DS_TYPE_COUNTER)
-     ret.counter = temp;
+   {
+     ret.counter = tmp_unsigned;
+   }
    else if (type == DS_TYPE_GAUGE)
    {
      ret.gauge = NAN;
      if (defined != 0)
-       ret.gauge = (scale * temp) + shift;
+       ret.gauge = (scale * tmp_signed) + shift;
    }
 +  else if (type == DS_TYPE_DERIVE)
 +    ret.derive = (derive_t) temp;
 +  else if (type == DS_TYPE_ABSOLUTE)
 +    ret.absolute = (absolute_t) temp;
 +  else
 +  {
 +    ERROR ("snmp plugin: csnmp_value_list_to_value: Unknown data source "
 +      "type: %i.", type);
 +    ret.gauge = NAN;
 +  }
  
    return (ret);
  } /* value_t csnmp_value_list_to_value */