Skip to content

Commit

Permalink
2067 uninitialized variables in zfs(1M) may make snapshots undestroyable
Browse files Browse the repository at this point in the history
Reviewed by: Joshua M. Clulow <[email protected]>
Reviewed by: Milan Jurik <[email protected]>
Reviewed by: Igor Kozhukhov <[email protected]>
Reviewed by: Garrett D'Amore <[email protected]>
Reviewed by: Matt Ahrens <[email protected]>
Reviewed by: Steve Gonczi <[email protected]>
Approved by: Garrett D'Amore <[email protected]>
  • Loading branch information
richlowe committed Feb 3, 2012
1 parent 09bb536 commit 05c998d
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions usr/src/cmd/zfs/zfs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,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)
Expand Down Expand Up @@ -1036,7 +1036,7 @@ destroy_print_cb(zfs_handle_t *zhp, void *arg)
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);
Expand Down Expand Up @@ -1114,7 +1114,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
Expand Down Expand Up @@ -1191,7 +1191,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)
Expand Down Expand Up @@ -1458,7 +1458,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 };

Expand Down Expand Up @@ -1695,7 +1695,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;

Expand Down Expand Up @@ -1901,7 +1901,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;
Expand Down Expand Up @@ -2189,7 +2189,7 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
char sid[ZFS_MAXNAMELEN+32];
uid_t id;
uint64_t classes;
int err;
int err = 0;
directory_error_t e;

(void) snprintf(sid, sizeof (sid), "%s-%u", domain, rid);
Expand Down Expand Up @@ -2537,7 +2537,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;
Expand Down Expand Up @@ -2895,7 +2895,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;

Expand Down Expand Up @@ -3024,7 +3024,7 @@ zfs_do_rename(int argc, char **argv)
{
zfs_handle_t *zhp;
int c;
int ret;
int ret = 0;
boolean_t recurse = B_FALSE;
boolean_t parents = B_FALSE;

Expand Down Expand Up @@ -3103,7 +3103,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] == '-') {
Expand Down Expand Up @@ -3224,7 +3224,7 @@ rollback_check(zfs_handle_t *zhp, void *data)
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 };
Expand Down Expand Up @@ -3342,7 +3342,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] == '-') {
Expand Down Expand Up @@ -3396,7 +3396,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;

Expand Down Expand Up @@ -5234,7 +5234,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 */
Expand Down Expand Up @@ -5811,7 +5811,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";
Expand Down Expand Up @@ -6204,7 +6204,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;
Expand Down Expand Up @@ -6354,7 +6354,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) {
Expand Down Expand Up @@ -6424,7 +6424,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;
Expand Down

0 comments on commit 05c998d

Please sign in to comment.