diff options
author | Lee Duncan <leeman.duncan@gmail.com> | 2019-03-14 09:21:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-14 09:21:14 -0700 |
commit | 3ed3339cb5f3b1ddefa3c626b8869adee5a6f729 (patch) | |
tree | bd4af2ac73a52f923e5668f4f4829670023a48b4 | |
parent | e74612a3246d0f00dbaed53670c0baa6ad0d031a (diff) | |
parent | ec2afb8a1c997bac706de4f70a3a59fdd82b5741 (diff) | |
download | open-iscsi-3ed3339cb5f3b1ddefa3c626b8869adee5a6f729.tar.gz |
Merge pull request #159 from gonzoleeman/fix-node-mode-return-for-none
Fix node print return value when no nodes.
-rw-r--r-- | usr/iscsiadm.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c index 7cb4b97..ef9ea84 100644 --- a/usr/iscsiadm.c +++ b/usr/iscsiadm.c @@ -681,14 +681,6 @@ static int login_portals(struct node_rec *pattern_rec) return rc; } -static void print_node_flat(struct iscsi_node *node) -{ - printf("%s,%" PRIu16 " %s\n", - iscsi_node_portal_get(node), - iscsi_node_tpgt_get(node), - iscsi_node_target_name_get(node)); -} - // The 'iface_mode' argument is only used for command // `iscsiadm -m iface -P 1` static void print_nodes_tree(struct iscsi_node **nodes, uint32_t node_count, @@ -718,34 +710,6 @@ static void print_nodes_tree(struct iscsi_node **nodes, uint32_t node_count, } } -static int print_nodes(struct iscsi_context *ctx, int info_level) -{ - struct iscsi_node **nodes = NULL; - uint32_t node_count = 0; - uint32_t i = 0; - int rc = 0; - - if ((info_level != 0) && (info_level != -1) && (info_level != 1)) { - log_error("Invalid info level %d. Try 0 or 1.", info_level); - rc = ISCSI_ERR_INVAL; - goto out; - } - - rc = iscsi_nodes_get(ctx, &nodes, &node_count); - if (rc != LIBISCSI_OK) - goto out; - - if (info_level == 1) - print_nodes_tree(nodes, node_count, _PRINT_MODE_NODE); - else - for (i = 0; i < node_count; ++i) - print_node_flat(nodes[i]); - -out: - iscsi_nodes_free(nodes, node_count); - return rc; -} - static int print_nodes_config(struct iscsi_context *ctx, bool show_secret, const char *target_name, const char *address, int32_t port, const char *iface_name) @@ -2816,14 +2780,6 @@ static int exec_node_op(struct iscsi_context *ctx, int op, int do_login, goto out; } - if ((!do_login && !do_logout && op == OP_NOOP) && - ((rec == NULL) || - (!strlen(rec->name) && !strlen(rec->conn[0].address) && - !strlen(rec->iface.name)))) { - rc = print_nodes(ctx, info_level); - goto out; - } - if (do_login) { rc = login_portals(rec); goto out; |