libvirt/src/storage
Eric Blake 1fbf190554 build: avoid unsafe functions in libgen.h
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>
2013-04-25 14:47:01 -06:00
..
parthelper.c storage: Add coverity[dead_error_condition] to avoid error 2013-01-22 16:59:46 +01:00
storage_backend_disk.c build: avoid unsafe functions in libgen.h 2013-04-25 14:47:01 -06:00
storage_backend_disk.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_fs.c storage: use f_frsize, not f_bsize, for calculating available space 2013-02-22 17:01:25 -07:00
storage_backend_fs.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_iscsi.c storage: Move virStorageBackendSCSIGetHostNumber into iscsi backend 2013-04-08 18:41:06 +08:00
storage_backend_iscsi.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_logical.c storage: Avoid double virCommandFree in virStorageBackendLogicalDeletePool 2013-03-29 11:09:32 +01:00
storage_backend_logical.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_mpath.c Disable cast-align warnings in various places 2013-04-08 10:03:21 +01:00
storage_backend_mpath.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_rbd.c storage: fix unlikely memory leak in rbd backend 2013-03-19 12:10:42 -04:00
storage_backend_rbd.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_scsi.c storage: Guess the parent if it's not specified for vHBA 2013-04-08 18:41:07 +08:00
storage_backend_scsi.h storage: Move virStorageBackendSCSIGetHostNumber into iscsi backend 2013-04-08 18:41:06 +08:00
storage_backend_sheepdog.c sheepdog: Omit braces with a single-line body 2013-04-22 08:33:35 -06:00
storage_backend_sheepdog.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend.c Extend previous check to validate driver struct field names 2013-04-24 10:59:53 +01:00
storage_backend.h storage: separate qemu-img command generation and execution 2013-02-24 18:11:40 +01:00
storage_driver.c Make driver method names consistent with public APIs 2013-04-24 11:00:18 +01:00
storage_driver.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00