[libvirt] [PATCH v4 1/4] storage: Split out the valid path check
John Ferlan
jferlan at redhat.com
Tue Apr 21 10:15:17 UTC 2015
}
>>>>
>>>> +bool
>>>> +virStorageBackendPoolPathIsStable(const char *path)
>>>> +{
>>>> + if (path == NULL || STREQ(path, "/dev") || STREQ(path, "/dev/"))
>>>> + return false;
>>>> +
>>>> + if (!STRPREFIX(path, "/dev"))
>>>> + return false;
>>>
>>> I think you want "/dev/" here as the prefix to be required; otherwise,
>>> "/device" would match the prefix. (This also means that someone using
>>> "//dev/..." would fail the check, but that's probably something we don't
>>> need to worry about).
>>>
>> Hmm... Sure I see that... I can make that adjustment. I'll wait a bit
>> before pushing just so see if there's other feedback...
>>
>
> I think that change should be separate from this code motion.
>
OK, so consider patch 1.5/4:
Fix the if (!STRPREFIX(path, "/dev")) to be if (!STRPREFIX(path, "/dev/"))
to ensure a path such as "/device" isn't declared stable.
Signed-off-by: John Ferlan <jferlan at redhat.com>
---
src/storage/storage_backend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index b07e0d9..e0311e1 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1680,7 +1680,7 @@ virStorageBackendPoolPathIsStable(const char *path)
if (path == NULL || STREQ(path, "/dev") || STREQ(path, "/dev/"))
return false;
- if (!STRPREFIX(path, "/dev"))
+ if (!STRPREFIX(path, "/dev/"))
return false;
return true;
--
2.1.0
More information about the libvir-list
mailing list