Skip to content
Snippets Groups Projects
Commit fb7ad7fb authored by David Bigagli's avatar David Bigagli
Browse files

Fix compilation error in switch_generic.c

parent e6b10131
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment