mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix file descriptor leak in swap signature detection
This commit is contained in:
parent
cca6ab596f
commit
c37a14506a
@ -2,6 +2,7 @@ Version 2.02.74 -
|
|||||||
==================================
|
==================================
|
||||||
Simplify MD/swap signature detection in pvcreate and allow aborting.
|
Simplify MD/swap signature detection in pvcreate and allow aborting.
|
||||||
Remove assumption that --yes must be used only in --force mode.
|
Remove assumption that --yes must be used only in --force mode.
|
||||||
|
Fix file descriptor leak in swap signature detection error path.
|
||||||
|
|
||||||
Version 2.02.73 - 18th August 2010
|
Version 2.02.73 - 18th August 2010
|
||||||
==================================
|
==================================
|
||||||
|
@ -42,7 +42,7 @@ int dev_is_swap(struct device *dev, uint64_t *signature)
|
|||||||
{
|
{
|
||||||
char buf[10];
|
char buf[10];
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
int page;
|
int page, ret = 0;
|
||||||
|
|
||||||
if (!dev_get_size(dev, &size)) {
|
if (!dev_get_size(dev, &size)) {
|
||||||
stack;
|
stack;
|
||||||
@ -66,11 +66,12 @@ int dev_is_swap(struct device *dev, uint64_t *signature)
|
|||||||
break;
|
break;
|
||||||
if (!dev_read(dev, page - SIGNATURE_SIZE,
|
if (!dev_read(dev, page - SIGNATURE_SIZE,
|
||||||
SIGNATURE_SIZE, buf)) {
|
SIGNATURE_SIZE, buf)) {
|
||||||
stack;
|
ret = -1;
|
||||||
return -1;
|
break;
|
||||||
}
|
}
|
||||||
if (_swap_detect_signature(buf)) {
|
if (_swap_detect_signature(buf)) {
|
||||||
*signature = page - SIGNATURE_SIZE;
|
*signature = page - SIGNATURE_SIZE;
|
||||||
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,10 +79,7 @@ int dev_is_swap(struct device *dev, uint64_t *signature)
|
|||||||
if (!dev_close(dev))
|
if (!dev_close(dev))
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
if (*signature)
|
return ret;
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user