aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-01-12 17:26:04 +0100
committerBrian Behlendorf <[email protected]>2022-02-01 16:55:11 -0800
commitbf12053cb24be9a2368c178cddc06d13dc08241d (patch)
tree3cf107eb3b143edbc7e923b7f8a266df3eedaf39 /cmd
parentfdcb79b52e2d4f231d5cbd2ae6fffb1be275558e (diff)
zpool: main: const correctness, use time_t for time
The cast will explode on 32-bit big-endian architectures Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12968
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zpool/zpool_main.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index d7cce73d3..579839c36 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -3136,7 +3136,7 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
{
int ret = 0;
zpool_handle_t *zhp;
- char *name;
+ const char *name;
uint64_t version;
name = fnvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME);
@@ -3157,7 +3157,7 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
ZPOOL_CONFIG_MMP_STATE);
if (mmp_state == MMP_STATE_ACTIVE) {
- char *hostname = "<unknown>";
+ const char *hostname = "<unknown>";
uint64_t hostid = 0;
if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTNAME))
@@ -3179,8 +3179,8 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
"system's hostid is not set. Set a unique hostid "
"with the zgenhostid(8) command.\n"), name);
} else {
- char *hostname = "<unknown>";
- uint64_t timestamp = 0;
+ const char *hostname = "<unknown>";
+ time_t timestamp = 0;
uint64_t hostid = 0;
if (nvlist_exists(config, ZPOOL_CONFIG_HOSTNAME))
@@ -3200,7 +3200,7 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
"Last accessed by %s (hostid=%lx) at %s"
"The pool can be imported, use 'zpool import -f' "
"to import the pool.\n"), name, hostname,
- (unsigned long)hostid, ctime((time_t *)&timestamp));
+ (unsigned long)hostid, ctime(&timestamp));
}
return (1);
@@ -3210,7 +3210,7 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
return (1);
if (newname != NULL)
- name = (char *)newname;
+ name = newname;
if ((zhp = zpool_open_canfail(g_zfs, name)) == NULL)
return (1);