]> git.ipfire.org Git - thirdparty/libvirt.git/commit
storage: Fix path check in storagePoolLookupByTargetPath
authorJohn Ferlan <jferlan@redhat.com>
Fri, 24 Nov 2017 13:17:02 +0000 (08:17 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 13 Dec 2017 19:51:30 +0000 (14:51 -0500)
commitd4f80d439ecbdca06dec9fc50d1860b150a6ea4f
tree9a1dd6e2cbcadfa734914ed12079ad7b49d4ba32
parent4199c2f221cf581f7a4258320a8eecd11a44babf
storage: Fix path check in storagePoolLookupByTargetPath

Commit id '5ab746b8' introduced the function as perhaps a copy
of storageVolLookupByPath; however, it did not use the @cleanpath
variable even though it used the virFileSanitizePath. So in essance
the only "check" being done for failure is whether it was possible
to strdup the path.

Looking at the virStoragePoolDefParseXML one will note that the
target.path is stored using the result of virFileSanitizePath.
Therefore, this function should sanitize and use the input @path
for the argument to storagePoolLookupByTargetPathCallback which
is comparing against stored target.path values.

Additionally, if there was an error we should use the proper error
of VIR_ERR_NO_STORAGE_POOL (instead of VIR_ERR_NO_STORAGE_VOL).
src/storage/storage_driver.c