Fix uninitialized variable in part-id
authorMartin Pitt <martin.pitt@ubuntu.com>
Thu, 21 Oct 2010 07:35:29 +0000 (09:35 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Thu, 21 Oct 2010 07:35:29 +0000 (09:35 +0200)
With gcc 4.5:

part-id.c: In function ‘main’:
part-id.c:186:9: error: ‘partition_number’ may be used uninitialized in this function

This only affected the error path, where we would return an arbitrary value in
get_part_table_device_file()'s out_partition_number (but return a failure
result). No big deal, but let's initialize it for quiescing gcc.

src/probers/part-id.c

index 25d91f9..658e7d9 100644 (file)
@@ -190,6 +190,7 @@ get_part_table_device_file (struct udev_device *given_device,
 
   devpath = NULL;
   offset = 0;
+  partition_number = 0;
   ret = NULL;
   partition_table_syspath = NULL;
   alignment_offset = 0;