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.
|
||||
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
|
||||
==================================
|
||||
|
@ -42,7 +42,7 @@ int dev_is_swap(struct device *dev, uint64_t *signature)
|
||||
{
|
||||
char buf[10];
|
||||
uint64_t size;
|
||||
int page;
|
||||
int page, ret = 0;
|
||||
|
||||
if (!dev_get_size(dev, &size)) {
|
||||
stack;
|
||||
@ -66,11 +66,12 @@ int dev_is_swap(struct device *dev, uint64_t *signature)
|
||||
break;
|
||||
if (!dev_read(dev, page - SIGNATURE_SIZE,
|
||||
SIGNATURE_SIZE, buf)) {
|
||||
stack;
|
||||
return -1;
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
if (_swap_detect_signature(buf)) {
|
||||
*signature = page - SIGNATURE_SIZE;
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -78,10 +79,7 @@ int dev_is_swap(struct device *dev, uint64_t *signature)
|
||||
if (!dev_close(dev))
|
||||
stack;
|
||||
|
||||
if (*signature)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user