if (link->ifindex <= 0)
return -EINVAL;
- r = asprintf(&link->state_file, "/run/systemd/network/links/%u",
- (unsigned) link->ifindex);
+ r = asprintf(&link->state_file, "/run/systemd/network/links/%"PRIu64,
+ link->ifindex);
if (r < 0)
- return r;
+ return -ENOMEM;
mac = udev_device_get_sysattr_value(device, "address");
if (mac) {
assert(link);
assert(link->state_file);
- r = mkdir_safe_label("/run/systemd/network/links", 0755, 0, 0);
- if (r < 0)
- goto finish;
-
r = fopen_temporary(link->state_file, &f, &temp_path);
if (r < 0)
goto finish;
link_state_to_string(link->state));
if (link->dhcp_lease) {
- const char *lease_file = "/run/systemd/network/leases/test.lease";
+ char *lease_file;
+
+ r = asprintf(&lease_file, "/run/systemd/network/leases/%"PRIu64,
+ link->ifindex);
+ if (r < 0)
+ return -ENOMEM;
r = dhcp_lease_save(link->dhcp_lease, lease_file);
if (r < 0)