]> granicus.if.org Git - zfs/commitdiff
Fix maybe uninitialized
authorBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 9 Nov 2015 20:10:02 +0000 (12:10 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 9 Nov 2015 20:15:19 +0000 (12:15 -0800)
As of gcc 5.1.1 20150618 (Red Hat 5.1.1-4) the -Werror=maybe-uninitialized
check detects that 'snapname' in recv_incremental_replication() may not be
initialized.  Explicitly initialize the variable to resolved the warning.

  libzfs_sendrecv.c: In function ‘recv_incremental_replication’:
  libzfs_sendrecv.c:2019:2: error: ‘snapname’ may be used uninitialized in
    (void) snprintf(buf, sizeof (buf), "%s@%s", fsname, snapname);

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
lib/libzfs/libzfs_sendrecv.c

index 8d1a210947a2c862db95cb8f9b19784fed17c531..bd2fd294706d661e721207f357a98a8a9b07dd8d 100644 (file)
@@ -2003,7 +2003,7 @@ created_before(libzfs_handle_t *hdl, avl_tree_t *avl,
     uint64_t guid1, uint64_t guid2)
 {
        nvlist_t *nvfs;
-       char *fsname, *snapname;
+       char *fsname = NULL, *snapname = NULL;
        char buf[ZFS_MAXNAMELEN];
        int rv;
        zfs_handle_t *guid1hdl, *guid2hdl;