The value is set dynamically when sd_device_get_subsystem() is called
first time.
Fixes the following issue:
```
$ build/udevadm test /sys/class/block/dm-1
...
Assertion '_subsystem' failed at src/libsystemd/sd-device/sd-device.c:767, function device_set_subsystem(). Aborting.
Program received signal SIGABRT, Aborted.
```
int device_shallow_clone(sd_device *old_device, sd_device **new_device) {
_cleanup_(sd_device_unrefp) sd_device *ret = NULL;
+ const char *subsystem;
int r;
assert(old_device);
if (r < 0)
return r;
- r = device_set_subsystem(ret, old_device->subsystem);
- if (r < 0)
- return r;
+ if (sd_device_get_subsystem(old_device, &subsystem) >= 0) {
+ r = device_set_subsystem(ret, subsystem);
+ if (r < 0)
+ return r;
+ } else
+ ret->subsystem_set = true;
ret->devnum = old_device->devnum;