test-attach-flags: make sure to restore kdbus attach_flags_mask on errors
authorDjalal Harouni <tixxdz@opendz.org>
Fri, 9 Jan 2015 22:18:45 +0000 (23:18 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Fri, 9 Jan 2015 22:18:45 +0000 (23:18 +0100)
If one of the test fails, then always restore
/sys/module/kdbus/parameters/attach_flags_mask to its previous saved
value.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test/test-attach-flags.c

index 633250cf5ecf885613a53ad99d1ff28c43e823b1..8bf6bc8722bd561476c5b0ccb224a0644fc0a8ca 100644 (file)
@@ -720,23 +720,27 @@ int kdbus_test_attach_flags(struct kdbus_test_env *env)
         * Test the connection creation attach flags
         */
        ret = kdbus_test_peers_creation(env);
+       /* Restore previous kdbus mask */
+       kdbus_sysfs_set_parameter_mask(env->mask_param_path,
+                                      old_kdbus_flags_mask);
        ASSERT_RETURN(ret == 0);
 
        /*
         * Test the CONN_INFO ioctl attach flags
         */
        ret = kdbus_test_peers_info(env);
+       /* Restore previous kdbus mask */
+       kdbus_sysfs_set_parameter_mask(env->mask_param_path,
+                                      old_kdbus_flags_mask);
        ASSERT_RETURN(ret == 0);
 
        /*
         * Test the Bus creator info and its attach flags
         */
        ret = kdbus_test_bus_creator_info(env);
-       ASSERT_RETURN(ret == 0);
-
        /* Restore previous kdbus mask */
-       ret = kdbus_sysfs_set_parameter_mask(env->mask_param_path,
-                                            old_kdbus_flags_mask);
+       kdbus_sysfs_set_parameter_mask(env->mask_param_path,
+                                      old_kdbus_flags_mask);
        ASSERT_RETURN(ret == 0);
 
        ret = kdbus_sysfs_get_parameter_mask(env->mask_param_path,