]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/bus-util: Don't replace exsting strv
authorKevin Kuehler <keur@xcf.berkeley.edu>
Tue, 10 Dec 2019 09:58:01 +0000 (01:58 -0800)
committerKevin Kuehler <keur@xcf.berkeley.edu>
Wed, 8 Jan 2020 02:48:50 +0000 (18:48 -0800)
Change the behavior of string arrays in a bus property map.  Previously,
passing the same strv pointer to more than one map entry would result in
the old strv being freed and overwritten. With this change, an existing
strv pointer is appended to.

This is important if we want to create one strv comprised of multiple
dependencies. This makes it so callers don't have to create one strv per
dependency and subsequently merge them into one strv.

src/shared/bus-util.c

index aea46d311996a548c8838f183c1015904cd21b71..10c05eba184772a94255bd8d259ac98bec59f989 100644 (file)
@@ -1127,7 +1127,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne
                 if (r < 0)
                         return r;
 
-                return strv_free_and_replace(*p, l);
+                return strv_extend_strv(p, l, false);
         }
 
         case SD_BUS_TYPE_BOOLEAN: {