[parted-devel] tests/label: Don't dereference NULL if open fails.

Otavio Salvador otavio at debian.org
Wed Mar 7 19:45:15 CET 2007


Jim Meyering <jim at meyering.net> writes:

> FYI:
>
> 	tests/label: Don't dereference NULL if open fails.
> 	* libparted/tests/label.c (START_TEST): Return right away if
> 	ped_device_get returns NULL.
>
> diff --git a/libparted/tests/label.c b/libparted/tests/label.c
> index f12e4c8..c043e37 100644
> --- a/libparted/tests/label.c
> +++ b/libparted/tests/label.c
> @@ -26,6 +26,8 @@ static void destroy_disk(void)
>  START_TEST (test_create_label)
>  {
>  		PedDevice *dev = ped_device_get(temporary_disk);
> +		if (dev == NULL)
> +			return;


Wouldn't be better to fail?

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the parted-devel mailing list