vfs_fruit: fix possible uninitialized use
authorRalph Boehme <rb@sernet.de>
Sat, 27 Sep 2014 06:03:12 +0000 (08:03 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 30 Sep 2014 21:35:08 +0000 (23:35 +0200)
Signed-off-by: Ralph Boehme <rb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/modules/vfs_fruit.c

index 0441d5ebd48501fb969fa76f14ed0e512d1d6709..dd40490984724e22b8ad36974f1c6bba17f13cd5 100644 (file)
@@ -755,11 +755,14 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
        struct adouble *meta_ad = NULL;
        SMB_STRUCT_STAT sbuf;
        bool ok;
-       int saved_errno;
+       int saved_errno = 0;
 
        SMB_VFS_HANDLE_GET_DATA(ad->ad_handle, config,
                                struct fruit_config_data, return -1);
 
+       /* Try rw first so we can use the fd in ad_convert() */
+       mode = O_RDWR;
+
        if (ad->ad_fsp && ad->ad_fsp->fh && (ad->ad_fsp->fh->fd != -1)) {
                fd = ad->ad_fsp->fh->fd;
        } else {
@@ -772,9 +775,6 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
                        }
                }
 
-               /* Try rw first so we can use the fd in ad_convert() */
-               mode = O_RDWR;
-
        retry:
                if (config->rsrc == FRUIT_RSRC_XATTR) {
 #ifndef HAVE_ATTROPEN