]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_fruit: initialise bandsize to please a compiler
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 9 Jan 2018 11:08:01 +0000 (00:08 +1300)
committerRalph Boehme <slow@samba.org>
Wed, 10 Jan 2018 00:01:23 +0000 (01:01 +0100)
GCC on a Ubuntu 16.04 instance said:

[3174/4240] Compiling source3/modules/vfs_cap.c
In file included from ../source3/include/includes.h:301:0,
                 from ../source3/modules/vfs_fruit.c:20:
                 ../source3/modules/vfs_fruit.c: In function
‘fruit_disk_free’:
../source3/../lib/util/debug.h:217:7: error: ‘bandsize’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
   && (dbgtext body) )
          ^
          ../source3/modules/vfs_fruit.c:6302:9: note: ‘bandsize’ was
declared here
  size_t bandsize;
           ^
           [3175/4240] Compiling source3/modules/vfs_expand_msdfs.c
           [3176/4240] Compiling source3/modules/vfs_shadow_copy.c
           [3177/4240] Compiling source3/modules/vfs_shadow_copy2.c
           cc1: all warnings being treated as errors
           Waf: Leaving directory
/home/ubuntu/autobuild/b17854/samba-o3/bin'
Build failed:  -> task failed (err #1):
{task: cc vfs_fruit.c -> vfs_fruit_25.o}
make: *** [all] Error 1

As far as I can tell, it is wrong, and the bandsize variable never
gets passed uninititalised to DEBUG.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_fruit.c

index 9533da4a5f853d49e4a1099cb73bd215af3c8afc..40ee2553a12c98a0ddbceec95b5934efe035ec3c 100644 (file)
@@ -6392,7 +6392,7 @@ static bool fruit_tmsize_do_dirent(vfs_handle_struct *handle,
        bool ok;
        char *p = NULL;
        size_t sparsebundle_strlen = strlen("sparsebundle");
-       size_t bandsize;
+       size_t bandsize = 0;
        size_t nbands;
        double tm_size;