From fb7ad7fbd0ac4d244a3fd749ba600768a3fec2b3 Mon Sep 17 00:00:00 2001 From: David Bigagli <david@schedmd.com> Date: Tue, 4 Feb 2014 14:33:12 -0800 Subject: [PATCH] Fix compilation error in switch_generic.c --- src/plugins/switch/generic/switch_generic.c | 28 ++++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/plugins/switch/generic/switch_generic.c b/src/plugins/switch/generic/switch_generic.c index f533a135d62..dbfd86637d7 100644 --- a/src/plugins/switch/generic/switch_generic.c +++ b/src/plugins/switch/generic/switch_generic.c @@ -719,28 +719,30 @@ int switch_p_job_attach(switch_jobinfo_t *jobinfo, char ***env, * String result of format : (nodename,(iface,IP_V{4,6},address)*) */ extern int switch_p_get_jobinfo(switch_jobinfo_t *switch_job, - int key, void *resulting_data) + int key, void *resulting_data) { int node_id = key; sw_gen_step_info_t *stepinfo = (sw_gen_step_info_t*) switch_job; - char *err = NULL; sw_gen_node_t *node_ptr = stepinfo->node_array[node_id]; sw_gen_ifa_t *ifa_ptr; int i, s; int bufsize = 1024; char *buf = xmalloc(bufsize); - /*bound triplet max len*/ int triplet_len_max = IFNAMSIZ + INET6_ADDRSTRLEN + 5 + 5 + 1; if (debug_flags & DEBUG_FLAG_SWITCH) info("switch_p_get_jobinfo() starting"); - if (!resulting_data) {err="no pointer for resulting_data"; goto error;} - *(char**) resulting_data = NULL; + if (!resulting_data) { + error("no pointer for resulting_data"); + return SLURM_ERROR; + } + + *(char **) resulting_data = NULL; if (node_id < 0 || node_id >= stepinfo->node_cnt) { - err = "node_id out of range"; - goto error; + error("node_id out of range"); + return SLURM_ERROR; } s = snprintf(buf, bufsize, "(%s", node_ptr->node_name); @@ -752,18 +754,14 @@ extern int switch_p_get_jobinfo(switch_jobinfo_t *switch_job, xrealloc(buf, bufsize); } s += snprintf(buf+s, bufsize-s, ",(%s,%s,%s)", - ifa_ptr->ifa_name, ifa_ptr->ifa_family, - ifa_ptr->ifa_addr); + ifa_ptr->ifa_name, ifa_ptr->ifa_family, + ifa_ptr->ifa_addr); } s += snprintf(buf+s, bufsize-s, ")"); - *(char**)resulting_data = buf; /* return x-alloc'ed data */ - return SLURM_SUCCESS; - - error: - if (debug_flags & DEBUG_FLAG_SWITCH) info(err); - return SLURM_ERROR; + *(char **)resulting_data = buf; /* return x-alloc'ed data */ + return SLURM_SUCCESS; } /* -- GitLab