neil / rpms / udisks2

Forked from rpms/udisks2 a year ago
Clone
eb981d
From 53a21faf97723b0e4d6c2ec9a32f61fecfa2f246 Mon Sep 17 00:00:00 2001
eb981d
From: Tomas Bzatek <tbzatek@redhat.com>
eb981d
Date: Fri, 3 Aug 2018 11:26:16 +0200
eb981d
Subject: [PATCH] lsm: Prevent overwriting already set error
eb981d
eb981d
---
eb981d
 modules/lsm/lsm_local.c | 9 ++++++---
eb981d
 1 file changed, 6 insertions(+), 3 deletions(-)
eb981d
eb981d
diff --git a/modules/lsm/lsm_local.c b/modules/lsm/lsm_local.c
eb981d
index 33ff198fd..a2a46442c 100644
eb981d
--- a/modules/lsm/lsm_local.c
eb981d
+++ b/modules/lsm/lsm_local.c
eb981d
@@ -132,6 +132,12 @@ get_blk_path (UDisksDriveLsmLocal *ud_drv_lsm_local,
eb981d
 
eb981d
   ud_blk = udisks_object_get_block (UDISKS_OBJECT (ud_lx_blk_obj));
eb981d
   blk_path = udisks_block_dup_device (ud_blk);
eb981d
+  if (blk_path == NULL)
eb981d
+    {
eb981d
+      g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
eb981d
+                                             "Failed to retrieve block path of specified disk drive");
eb981d
+      goto out;
eb981d
+    }
eb981d
 
eb981d
 out:
eb981d
   g_clear_object (&ud_blk);
eb981d
@@ -156,9 +162,6 @@ led_control (UDisksDriveLsmLocal *ud_drv_lsm_local,
eb981d
   blk_path = get_blk_path(ud_drv_lsm_local, invocation);
eb981d
   if (blk_path == NULL)
eb981d
     {
eb981d
-      g_dbus_method_invocation_return_error
eb981d
-        (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
eb981d
-         "Failed to retrieve block path of specified disk drive");
eb981d
       goto out;
eb981d
     }
eb981d