]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount-tool: correct arg_bind_device check
authorMike Yuan <me@yhndnzj.com>
Sun, 23 Feb 2025 16:47:09 +0000 (17:47 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 3 Mar 2025 09:45:56 +0000 (10:45 +0100)
src/mount/mount-tool.c

index aa6fd27b03c39c8c7c40aa16cd8c33c8b20e62fa..40056eeeb0bbb318e641d9bb376e8512bfd8dc80 100644 (file)
@@ -510,13 +510,16 @@ static int parse_argv(int argc, char *argv[]) {
 static int transient_unit_set_properties(sd_bus_message *m, UnitType t, char **properties) {
         int r;
 
+        assert(m);
+        assert(IN_SET(t, UNIT_MOUNT, UNIT_AUTOMOUNT));
+
         if (!isempty(arg_description)) {
                 r = sd_bus_message_append(m, "(sv)", "Description", "s", arg_description);
                 if (r < 0)
                         return r;
         }
 
-        if (arg_bind_device && is_device_path(arg_mount_what)) {
+        if (arg_bind_device > 0 && is_device_path(arg_mount_what)) {
                 _cleanup_free_ char *device_unit = NULL;
 
                 r = unit_name_from_path(arg_mount_what, ".device", &device_unit);