1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Fix first_seg() call for empty segment list.

The seg variable is temporary variable for list iterator,
code cannot expect that after iteration it remains NULL
(it contains non-NULL pointer here id list is empty).

Patch fixes first_seg function so it now correctly returns NULL
for empty segment list.
This commit is contained in:
Milan Broz 2009-05-12 19:09:21 +00:00
parent 1cbdc00ecc
commit 920e68d603
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.46 - Version 2.02.46 -
================================ ================================
Fix first_seg() call for empty segment list.
Add make install_lvm2 as complement to device-mapper install. Add make install_lvm2 as complement to device-mapper install.
Reject missing PVs from allocation in toollib. Reject missing PVs from allocation in toollib.
Fix PV datalignment for values starting prior to MDA area. (2.02.45) Fix PV datalignment for values starting prior to MDA area. (2.02.45)

View File

@ -1108,12 +1108,12 @@ struct lv_segment *find_seg_by_le(const struct logical_volume *lv, uint32_t le)
struct lv_segment *first_seg(const struct logical_volume *lv) struct lv_segment *first_seg(const struct logical_volume *lv)
{ {
struct lv_segment *seg = NULL; struct lv_segment *seg;
dm_list_iterate_items(seg, &lv->segments) dm_list_iterate_items(seg, &lv->segments)
break; return seg;
return seg; return NULL;
} }
/* Find segment at a given physical extent in a PV */ /* Find segment at a given physical extent in a PV */