[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v4 1/4] storage: Split out the valid path check



}
>>>>  
>>>> +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 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]