Addresses https://github.com/systemd/systemd/pull/30021#discussion_r1521595855.
r = path_is_read_only_fs("/var/lib/systemd/network/");
if (r < 0)
return log_warning_errno(r, "Failed to check if /var/lib/systemd/network/ is writable: %m");
- if (r > 0)
- return log_warning_errno(SYNTHETIC_ERRNO(EROFS), "The directory /var/lib/systemd/network/ is read-only.");
+ if (r > 0) {
+ log_warning("The directory /var/lib/systemd/network/ is read-only.");
+ return varlink_error(vlink, "io.systemd.Network.StorageReadOnly", NULL);
+ }
}
r = varlink_verify_polkit_async(
SetPersistentStorage,
VARLINK_DEFINE_INPUT(Ready, VARLINK_BOOL, 0));
+static VARLINK_DEFINE_ERROR(StorageReadOnly);
+
VARLINK_DEFINE_INTERFACE(
io_systemd_Network,
"io.systemd.Network",
&vl_method_GetLLDPNeighbors,
&vl_method_SetPersistentStorage,
&vl_type_LLDPNeighbor,
- &vl_type_LLDPNeighborsByInterface);
+ &vl_type_LLDPNeighborsByInterface,
+ &vl_error_StorageReadOnly);