mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
validate_lvname: early exit
If the LV name does not any have '_' chr, there is no point trying to call 'strstr()' to look for "_suffix". Also we can search from _.
This commit is contained in:
parent
ae8ba49142
commit
7bf404db3b
@ -172,6 +172,9 @@ static const char *_lvname_has_reserved_component_string(const char *lvname)
|
||||
};
|
||||
unsigned i;
|
||||
|
||||
if (!(lvname = strchr(lvname, '_')))
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < DM_ARRAY_SIZE(_strings); ++i)
|
||||
if (strstr(lvname, _strings[i]))
|
||||
return _strings[i];
|
||||
@ -189,6 +192,9 @@ static const char *_lvname_has_reserved_string(const char *lvname)
|
||||
unsigned i;
|
||||
const char *cs;
|
||||
|
||||
if (!(lvname = strchr(lvname, '_')))
|
||||
return NULL;
|
||||
|
||||
if ((cs = _lvname_has_reserved_component_string(lvname)))
|
||||
return cs;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user