1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-31 21:18:26 +03:00

Set all parameters to 0

Since the function dm_get_next_target() returns NULL as 'next' pointer
so it's not a 'real' error - set 0 to all parameters when NULL is
returned because of missing head.

i.e. one of use case::
do {
	next = dm_get_next_target(dmt, next, &start, &length,
				  &target_type, &params);
	size += length;
} while (next);
This commit is contained in:
Zdenek Kabelac 2012-02-08 11:25:09 +00:00
parent e6b610e8ed
commit fb6a209080
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.70 -
===================================
Set all parameters to 0 for dm_get_next_target() for NULL return.
Fix fd resource leak in error path for _udev_notify_sem_create().
Leave space for '\0' for readline() call in _sysfs_get_kernel_name().

View File

@ -573,8 +573,13 @@ void *dm_get_next_target(struct dm_task *dmt, void *next,
if (!t)
t = dmt->head;
if (!t)
if (!t) {
*start = 0;
*length = 0;
*target_type = 0;
*params = 0;
return NULL;
}
*start = t->start;
*length = t->length;