common.c: Use _LINUX_CAPABILITY_VERSION_3 in cap_header
[collectd.git] / src / daemon / common.c
index 45f9d53..477d759 100644 (file)
 extern kstat_ctl_t *kc;
 #endif
 
+/* AIX doesn't have MSG_DONTWAIT */
+#ifndef MSG_DONTWAIT
+#  define MSG_DONTWAIT MSG_NONBLOCK
+#endif
+
 #if !HAVE_GETPWNAM_R
 static pthread_mutex_t getpwnam_r_lock = PTHREAD_MUTEX_INITIALIZER;
 #endif
@@ -1124,7 +1129,7 @@ int parse_value (const char *value_orig, value_t *ret_value, int ds_type)
   }
 
   if (value == endptr) {
-    ERROR ("parse_value: Failed to parse string as %s: %s.",
+    ERROR ("parse_value: Failed to parse string as %s: \"%s\".",
         DS_TYPE_TO_STRING (ds_type), value);
     sfree (value);
     return -1;
@@ -1677,14 +1682,14 @@ void strarray_free (char **array, size_t array_len) /* {{{ */
 int check_capability (int capability) /* {{{ */
 {
 #ifdef _LINUX_CAPABILITY_VERSION_3
-       cap_user_header_t cap_header = calloc(sizeof (*cap_header), 1);
+       cap_user_header_t cap_header = calloc(1, sizeof (*cap_header));
        if (cap_header == NULL)
        {
                ERROR("check_capability: calloc failed");
                return (-1);
        }
 
-       cap_user_data_t cap_data = calloc(sizeof (*cap_data), 1);
+       cap_user_data_t cap_data = calloc(1, sizeof (*cap_data));
        if (cap_data == NULL)
        {
                ERROR("check_capability: calloc failed");
@@ -1693,7 +1698,7 @@ int check_capability (int capability) /* {{{ */
        }
 
        cap_header->pid = getpid();
-       cap_header->version = _LINUX_CAPABILITY_VERSION;
+       cap_header->version = _LINUX_CAPABILITY_VERSION_3;
        if (capget(cap_header, cap_data) < 0)
        {
                ERROR("check_capability: capget failed");