mirror of
https://github.com/systemd/systemd
synced 2024-09-06 08:46:19 +00:00
network/varlink: return StorageReadOnly error
Addresses https://github.com/systemd/systemd/pull/30021#discussion_r1521595855.
This commit is contained in:
parent
8cbc701ded
commit
cac8e820d6
|
@ -188,8 +188,10 @@ static int vl_method_set_persistent_storage(Varlink *vlink, JsonVariant *paramet
|
|||
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(
|
||||
|
|
|
@ -44,6 +44,8 @@ static VARLINK_DEFINE_METHOD(
|
|||
SetPersistentStorage,
|
||||
VARLINK_DEFINE_INPUT(Ready, VARLINK_BOOL, 0));
|
||||
|
||||
static VARLINK_DEFINE_ERROR(StorageReadOnly);
|
||||
|
||||
VARLINK_DEFINE_INTERFACE(
|
||||
io_systemd_Network,
|
||||
"io.systemd.Network",
|
||||
|
@ -52,4 +54,5 @@ VARLINK_DEFINE_INTERFACE(
|
|||
&vl_method_GetLLDPNeighbors,
|
||||
&vl_method_SetPersistentStorage,
|
||||
&vl_type_LLDPNeighbor,
|
||||
&vl_type_LLDPNeighborsByInterface);
|
||||
&vl_type_LLDPNeighborsByInterface,
|
||||
&vl_error_StorageReadOnly);
|
||||
|
|
Loading…
Reference in a new issue