]> sourceware.org Git - lvm2.git/commitdiff
Detect errors from dm_task_set calls
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 22 Dec 2010 15:28:44 +0000 (15:28 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 22 Dec 2010 15:28:44 +0000 (15:28 +0000)
Check for errors in dm_task_set calls.
Use  goto_bad macro with stack trace.
Replace  label  failed: with bad:.

WHATS_NEW
daemons/dmeventd/libdevmapper-event.c

index 2ba8e8555af5b1cd8f0edd4d2226fe70c05fdcbd..4fc811bc54b43775d29cb8b8aae82a7f977e1b33 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.80 - 
 ====================================
+  Detect errors from dm_task_set calls in _get_device_info (dmeventd).
   Add backtraces for archive and backup_locally in check_current_backup().
   Fix memory leak in debug mode of restart_clvmd() error path.
   Log error message for pthread_join() failure in clvmd.
index bc8ad993dd718cef80d17f3cd211ce967a933435..05ebf0abe0573a87134f2347848f57e3b645ce40 100644 (file)
@@ -538,34 +538,37 @@ static struct dm_task *_get_device_info(const struct dm_event_handler *dmevh)
                return NULL;
        }
 
-       if (dmevh->uuid)
-               dm_task_set_uuid(dmt, dmevh->uuid);
-       else if (dmevh->dev_name)
-               dm_task_set_name(dmt, dmevh->dev_name);
-       else if (dmevh->major && dmevh->minor) {
-               dm_task_set_major(dmt, dmevh->major);
-               dm_task_set_minor(dmt, dmevh->minor);
-        }
+       if (dmevh->uuid) {
+               if (!dm_task_set_uuid(dmt, dmevh->uuid))
+                       goto_bad;
+       } else if (dmevh->dev_name) {
+               if (!dm_task_set_name(dmt, dmevh->dev_name))
+                       goto_bad;
+       } else if (dmevh->major && dmevh->minor) {
+               if (!dm_task_set_major(dmt, dmevh->major) ||
+                   !dm_task_set_minor(dmt, dmevh->minor))
+                       goto_bad;
+       }
 
        /* FIXME Add name or uuid or devno to messages */
        if (!dm_task_run(dmt)) {
                log_error("_get_device_info: dm_task_run() failed");
-               goto failed;
+               goto bad;
        }
 
        if (!dm_task_get_info(dmt, &info)) {
                log_error("_get_device_info: failed to get info for device");
-               goto failed;
+               goto bad;
        }
 
        if (!info.exists) {
                log_error("_get_device_info: device not found");
-               goto failed;
+               goto bad;
        }
 
        return dmt;
 
-failed:
+      bad:
        dm_task_destroy(dmt);
        return NULL;
 }
This page took 0.045083 seconds and 5 git commands to generate.