Author: mm
Date: Tue Feb  7 18:35:18 2012
New Revision: 231144
URL: http://svn.freebsd.org/changeset/base/231144

Log:
  Merge illumos revision 13594:
  
  uninitialized variables in zfs(8) may make snapshots undestroyable [1]
  
  References:
  https://www.illumos.org/issues/2067 [1]
  
  Obtained from:        illumos (issue #2067)
  MFC after:    3 days

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c    Tue Feb  7 18:05:10 
2012        (r231143)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c    Tue Feb  7 18:35:18 
2012        (r231144)
@@ -590,7 +590,7 @@ zfs_do_clone(int argc, char **argv)
        zfs_handle_t *zhp = NULL;
        boolean_t parents = B_FALSE;
        nvlist_t *props;
-       int ret;
+       int ret = 0;
        int c;
 
        if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0)
@@ -1052,7 +1052,7 @@ destroy_print_cb(zfs_handle_t *zhp, void
 static int
 destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_cbdata_t *cb)
 {
-       int err;
+       int err = 0;
        assert(cb->cb_firstsnap == NULL);
        assert(cb->cb_prevsnap == NULL);
        err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb);
@@ -1130,7 +1130,7 @@ destroy_clones(destroy_cbdata_t *cb)
                    ZFS_TYPE_SNAPSHOT);
                if (zhp != NULL) {
                        boolean_t defer = cb->cb_defer_destroy;
-                       int err;
+                       int err = 0;
 
                        /*
                         * We can't defer destroy non-snapshots, so set it to
@@ -1207,7 +1207,7 @@ zfs_do_destroy(int argc, char **argv)
 
        at = strchr(argv[0], '@');
        if (at != NULL) {
-               int err;
+               int err = 0;
 
                /* Build the list of snaps to destroy in cb_nvl. */
                if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0)
@@ -1474,7 +1474,7 @@ zfs_do_get(int argc, char **argv)
        zprop_get_cbdata_t cb = { 0 };
        int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
        char *value, *fields;
-       int ret;
+       int ret = 0;
        int limit = 0;
        zprop_list_t fake_name = { 0 };
 
@@ -1711,7 +1711,7 @@ zfs_do_inherit(int argc, char **argv)
        zfs_prop_t prop;
        inherit_cbdata_t cb = { 0 };
        char *propname;
-       int ret;
+       int ret = 0;
        int flags = 0;
        boolean_t received = B_FALSE;
 
@@ -1917,7 +1917,7 @@ zfs_do_upgrade(int argc, char **argv)
 {
        boolean_t all = B_FALSE;
        boolean_t showversions = B_FALSE;
-       int ret;
+       int ret = 0;
        upgrade_cbdata_t cb = { 0 };
        char c;
        int flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
@@ -2206,7 +2206,7 @@ userspace_cb(void *arg, const char *doma
                uid_t id;
                uint64_t classes;
 #ifdef sun
-               int err;
+               int err = 0;
                directory_error_t e;
 #endif
 
@@ -2562,7 +2562,7 @@ zfs_do_userspace(int argc, char **argv)
        boolean_t prtnum = B_FALSE;
        boolean_t parseable = B_FALSE;
        boolean_t sid2posix = B_FALSE;
-       int error;
+       int error = 0;
        int c;
        zfs_sort_column_t *default_sortcol = NULL;
        zfs_sort_column_t *sortcol = NULL;
@@ -2925,7 +2925,7 @@ zfs_do_list(int argc, char **argv)
        list_cbdata_t cb = { 0 };
        char *value;
        int limit = 0;
-       int ret;
+       int ret = 0;
        zfs_sort_column_t *sortcol = NULL;
        int flags = ZFS_ITER_PROP_LISTSNAPS | ZFS_ITER_ARGS_CAN_BE_PATHS;
 
@@ -3062,7 +3062,9 @@ zfs_do_rename(int argc, char **argv)
 {
        zfs_handle_t *zhp;
        renameflags_t flags = { 0 };
-       int c, ret, types;
+       int c;
+       int ret = 0;
+       int types;
        boolean_t parents = B_FALSE;
 
        /* check options */
@@ -3155,7 +3157,7 @@ static int
 zfs_do_promote(int argc, char **argv)
 {
        zfs_handle_t *zhp;
-       int ret;
+       int ret = 0;
 
        /* check options */
        if (argc > 1 && argv[1][0] == '-') {
@@ -3276,7 +3278,7 @@ rollback_check(zfs_handle_t *zhp, void *
 static int
 zfs_do_rollback(int argc, char **argv)
 {
-       int ret;
+       int ret = 0;
        int c;
        boolean_t force = B_FALSE;
        rollback_cbdata_t cb = { 0 };
@@ -3394,7 +3396,7 @@ static int
 zfs_do_set(int argc, char **argv)
 {
        set_cbdata_t cb;
-       int ret;
+       int ret = 0;
 
        /* check for options */
        if (argc > 1 && argv[1][0] == '-') {
@@ -3448,7 +3450,7 @@ static int
 zfs_do_snapshot(int argc, char **argv)
 {
        boolean_t recursive = B_FALSE;
-       int ret;
+       int ret = 0;
        char c;
        nvlist_t *props;
 
@@ -5286,7 +5288,7 @@ zfs_do_holds(int argc, char **argv)
        holds_cbdata_t cb = { 0 };
 
        int limit = 0;
-       int ret;
+       int ret = 0;
        int flags = 0;
 
        /* check options */
@@ -5863,7 +5865,7 @@ static int
 unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
 {
        zfs_handle_t *zhp;
-       int ret;
+       int ret = 0;
        struct stat64 statbuf;
        struct extmnttab entry;
        const char *cmdname = (op == OP_SHARE) ? "unshare" : "unmount";
@@ -6331,7 +6333,7 @@ manual_mount(int argc, char **argv)
        zfs_handle_t *zhp;
        char mountpoint[ZFS_MAXPROPLEN];
        char mntopts[MNT_LINE_MAX] = { '\0' };
-       int ret;
+       int ret = 0;
        int c;
        int flags = 0;
        char *dataset, *path;
@@ -6481,7 +6483,7 @@ zfs_do_diff(int argc, char **argv)
        char *tosnap = NULL;
        char *fromsnap = NULL;
        char *atp, *copy;
-       int err;
+       int err = 0;
        int c;
 
        while ((c = getopt(argc, argv, "FHt")) != -1) {
@@ -6551,7 +6553,7 @@ zfs_do_diff(int argc, char **argv)
 int
 main(int argc, char **argv)
 {
-       int ret;
+       int ret = 0;
        int i;
        char *progname;
        char *cmdname;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to