test-attach: fix attach-flags so we can SKIP it in unprivleged userns
authorDjalal Harouni <tixxdz@opendz.org>
Wed, 17 Dec 2014 19:47:54 +0000 (20:47 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Wed, 17 Dec 2014 20:37:07 +0000 (21:37 +0100)
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test/test-attach-flags.c

index 83c8711428d768a24507dbb3de53f6143b799de7..633250cf5ecf885613a53ad99d1ff28c43e823b1 100644 (file)
@@ -690,6 +690,18 @@ int kdbus_test_attach_flags(struct kdbus_test_env *env)
        if (!ret)
                return TEST_SKIP;
 
+       /*
+        * We need to be able to write to
+        * "/sys/module/kdbus/parameters/attach_flags_mask"
+        * perhaps we are unprvileged/privileged in its userns
+        */
+       ret = access(env->mask_param_path, W_OK);
+       if (ret < 0) {
+               kdbus_printf("--- access() '%s' failed: %d (%m)\n",
+                            env->mask_param_path, -errno);
+               return TEST_SKIP;
+       }
+
        ret = kdbus_sysfs_get_parameter_mask(env->mask_param_path,
                                             &old_kdbus_flags_mask);
        ASSERT_RETURN(ret == 0);