mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-02 11:21:12 +00:00
1fbf190554
POSIX says that both basename() and dirname() may return static storage (aka they need not be thread-safe); and that they may but not must modify their input argument. Furthermore, <libgen.h> is not available on all platforms. For these reasons, you should never use these functions in a multi-threaded library. Gnulib instead recommends a way to avoid the portability nightmare: gnulib's "dirname.h" provides useful thread-safe counterparts. The obvious dir_name() and base_name() are GPL (because they malloc(), but call exit() on failure) so we can't use them; but the LGPL variants mdir_name() (malloc's or returns NULL) and last_component (always points into the incoming string without modifying it, differing from basename semantics only on corner cases like the empty string that we shouldn't be hitting in the first place) are already in use in libvirt. This finishes the swap over to the safe functions. * cfg.mk (sc_prohibit_libgen): New rule. * src/util/vircgroup.c: Fix offenders. * src/parallels/parallels_storage.c (parallelsPoolAddByDomain): Likewise. * src/parallels/parallels_network.c (parallelsGetBridgedNetInfo): Likewise. * src/node_device/node_device_udev.c (udevProcessSCSIHost) (udevProcessSCSIDevice): Likewise. * src/storage/storage_backend_disk.c (virStorageBackendDiskDeleteVol): Likewise. * src/util/virpci.c (virPCIGetDeviceAddressFromSysfsLink): Likewise. * src/util/virstoragefile.h (_virStorageFileMetadata): Avoid false positive. Signed-off-by: Eric Blake <eblake@redhat.com> |
||
---|---|---|
.. | ||
parthelper.c | ||
storage_backend_disk.c | ||
storage_backend_disk.h | ||
storage_backend_fs.c | ||
storage_backend_fs.h | ||
storage_backend_iscsi.c | ||
storage_backend_iscsi.h | ||
storage_backend_logical.c | ||
storage_backend_logical.h | ||
storage_backend_mpath.c | ||
storage_backend_mpath.h | ||
storage_backend_rbd.c | ||
storage_backend_rbd.h | ||
storage_backend_scsi.c | ||
storage_backend_scsi.h | ||
storage_backend_sheepdog.c | ||
storage_backend_sheepdog.h | ||
storage_backend.c | ||
storage_backend.h | ||
storage_driver.c | ||
storage_driver.h |