On Tue, May 24, 2016 at 06:20:43PM +0200, Maros Zatko wrote:
Make guestfs_int_count_strings a bit more robust and usefull with
NULL
initialized variables.
---
src/utils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/utils.c b/src/utils.c
index f099a22..3639e92 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -55,6 +55,9 @@ guestfs_int_count_strings (char *const *argv)
{
size_t r;
+ if (argv == NULL)
+ return 0;
+
Not sure about this. Wouldn't we prefer that it crashes since that
would indicate a programming error? ('Course it would be nice if we
had a language that enforced this statically at compile time, but I've
never heard of such a thing ...)
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top