run: Allows the user to reset CPUAffinity= back to an empty list
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 30 Nov 2017 07:29:48 +0000 (16:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 6 Dec 2017 01:32:48 +0000 (10:32 +0900)
Before this CPUAffinity= requires a valid cpu set, and the setting
cannot be reset. Moreover, if CPUAffinity= with empty string is passed,
then message container is closed without no values appended, thus
we get error.
This makes CPUAffinity= accepts empty string to reset the setting
and avoid error.

src/shared/bus-unit-util.c

index 6ed0085..643daa6 100644 (file)
@@ -705,8 +705,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
                 if (r < 0)
                         return bus_log_create_error(r);
 
-                if (cpuset)
-                        sd_bus_message_append_array(m, 'y', cpuset, CPU_ALLOC_SIZE(ncpus));
+                sd_bus_message_append_array(m, 'y', cpuset, CPU_ALLOC_SIZE(ncpus));
 
                 r = sd_bus_message_close_container(m);