mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
tests/disks: Don't segfault if guestfs_list_devices returns an error.
Although it's highly unlikely in normal use, while testing device name translation patches it did happen and caused the test to segfault instead of exiting with an error.
This commit is contained in:
@@ -261,6 +261,8 @@ do_test (guestfs_h *g, size_t ndisks, bool just_add)
|
||||
|
||||
/* Check the disks were added. */
|
||||
devices = guestfs_list_devices (g);
|
||||
if (devices == NULL)
|
||||
exit (EXIT_FAILURE);
|
||||
n = guestfs_int_count_strings (devices);
|
||||
if (n != ndisks) {
|
||||
fprintf (stderr, "%s: incorrect number of devices returned by guestfs_list_devices:\n",
|
||||
|
||||
Reference in New Issue
Block a user