Skip to content
Snippets Groups Projects
Commit 1812f02f authored by Georges Da Costa's avatar Georges Da Costa
Browse files

Corrects -i X crash when no infiniband network is available

parent 846ac415
Branches
No related tags found
No related merge requests found
......@@ -66,3 +66,9 @@ unsigned int init_infiniband(char* infi_path, void**ptr) {
return 4;
}
char *_labels_infiniband[4] = {"irxp", "irxb", "itxp", "itxb"};
void label_infiniband(char **labels, void*none) {
for(int i=0; i<4; i++)
labels[i] = _labels_infiniband[i];
}
......@@ -19,3 +19,4 @@
*******************************************************/
unsigned int init_infiniband(char* infi_path, void**ptr);
void label_infiniband(char **labels, void*);
......@@ -81,11 +81,17 @@ void add_source(initializer_t init, char* arg, labeler_t labeler,
getter_t get, cleaner_t clean) {
nb_sources++;
states = realloc(states, nb_sources*sizeof(void*));
int nb = init(arg, &states[nb_sources-1]);
if (nb == 0) {
nb_sources--;
states = realloc(states, nb_sources*sizeof(void*));
return;
}
getter = realloc(getter, nb_sources*sizeof(void*));
getter[nb_sources-1] = get;
cleaner = realloc(cleaner, nb_sources*sizeof(void*));
cleaner[nb_sources-1] = clean;
int nb = init(arg, &states[nb_sources-1]);
labels = realloc(labels, (nb_sensors+nb)*sizeof(char*));
labeler(labels+nb_sensors, states[nb_sources-1]);
......@@ -128,7 +134,7 @@ int main(int argc, char **argv) {
add_source(init_network, argv[optind], label_network, get_network, clean_network);
break;
case 'i':
add_source(init_infiniband, argv[optind], label_network, get_network, clean_network);
add_source(init_infiniband, argv[optind], label_infiniband, get_network, clean_network);
break;
case 'o':
output = fopen(argv[optind],"wb");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment