1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix segfault in persistent_filter_dump() if lvm init fails.

Just return_0 in persistent_filter_dump() if passed a NULL filter;
This commit is contained in:
Dave Wysochanski 2009-07-08 18:13:32 +00:00
parent 71e41d9139
commit f882633886

View File

@ -177,7 +177,7 @@ static void _write_array(struct pfilter *pf, FILE *fp, const char *path,
int persistent_filter_dump(struct dev_filter *f) int persistent_filter_dump(struct dev_filter *f)
{ {
struct pfilter *pf = (struct pfilter *) f->private; struct pfilter *pf;
char *tmp_file; char *tmp_file;
struct stat info, info2; struct stat info, info2;
struct config_tree *cft = NULL; struct config_tree *cft = NULL;
@ -185,6 +185,10 @@ int persistent_filter_dump(struct dev_filter *f)
int lockfd; int lockfd;
int r = 0; int r = 0;
if (!f)
return_0;
pf = (struct pfilter *) f->private;
if (!dm_hash_get_num_entries(pf->devices)) { if (!dm_hash_get_num_entries(pf->devices)) {
log_very_verbose("Internal persistent device cache empty " log_very_verbose("Internal persistent device cache empty "
"- not writing to %s", pf->file); "- not writing to %s", pf->file);