From 0d6c9279d36d35f0d776a82224865d085b811d4e Mon Sep 17 00:00:00 2001 From: Akula Susmitha Date: Thu, 10 Oct 2024 17:25:35 +0530 Subject: [PATCH] iface-modem-messaging: Validate supported storages Check for supported storages before setting default storage. Signed-off-by: Akula Susmitha --- src/mm-iface-modem-messaging.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c index c89477fb..a064f11e 100644 --- a/src/mm-iface-modem-messaging.c +++ b/src/mm-iface-modem-messaging.c @@ -428,11 +428,9 @@ handle_set_default_storage_auth_ready (MMBaseModem *self, return; } - if (ctx->storage == MM_SMS_STORAGE_UNKNOWN) { - mm_dbus_method_invocation_return_error (ctx->invocation, - MM_CORE_ERROR, - MM_CORE_ERROR_UNSUPPORTED, - "Cannot set default storage: Unknown storage"); + /* Check if the requested storage is supported or not */ + if (!mm_iface_modem_messaging_is_storage_supported_for_storing (ctx->self, ctx->storage, &error)) { + mm_dbus_method_invocation_take_error (ctx->invocation, error); handle_set_default_storage_context_free (ctx); return; }