diff options
author | Damian Szuberski <[email protected]> | 2022-02-21 04:20:00 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2022-02-20 19:20:00 -0800 |
commit | 806739f991aa0d3fc5a36989fff8d8ab8fddf78f (patch) | |
tree | c486b2dd5f9d9ade96b7e5e897193607fcaa241d /cmd/zfs/zfs_iter.c | |
parent | e41013078a90d5790c737eec573ec376ca21a234 (diff) |
Correct compilation errors reported by GCC 10/11
New `zfs_type_t` value `ZFS_TYPE_INVALID` is introduced.
Variable initialization is now possible to make GCC happy.
Reviewed by: Brian Behlendorf <[email protected]>
Signed-off-by: szubersk <[email protected]>
Closes #12167
Closes #13103
Diffstat (limited to 'cmd/zfs/zfs_iter.c')
-rw-r--r-- | cmd/zfs/zfs_iter.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd/zfs/zfs_iter.c b/cmd/zfs/zfs_iter.c index 69b802f77..8b6a49a79 100644 --- a/cmd/zfs/zfs_iter.c +++ b/cmd/zfs/zfs_iter.c @@ -453,23 +453,21 @@ zfs_for_each(int argc, char **argv, int flags, zfs_type_t types, cb.cb_flags |= ZFS_ITER_RECURSE; ret = zfs_iter_root(g_zfs, zfs_callback, &cb); } else { - int i; - zfs_handle_t *zhp; - zfs_type_t argtype; + zfs_handle_t *zhp = NULL; + zfs_type_t argtype = types; /* * If we're recursive, then we always allow filesystems as * arguments. If we also are interested in snapshots or * bookmarks, then we can take volumes as well. */ - argtype = types; if (flags & ZFS_ITER_RECURSE) { argtype |= ZFS_TYPE_FILESYSTEM; if (types & (ZFS_TYPE_SNAPSHOT | ZFS_TYPE_BOOKMARK)) argtype |= ZFS_TYPE_VOLUME; } - for (i = 0; i < argc; i++) { + for (int i = 0; i < argc; i++) { if (flags & ZFS_ITER_ARGS_CAN_BE_PATHS) { zhp = zfs_path_to_zhandle(g_zfs, argv[i], argtype); |