Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/netcomplexity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ namespace ecolab
const int read_pipe=0, write_pipe=1;
int pipes[2];
if (pipe(pipes)!=0)
throw error(strerror(errno));
throw error("%s", strerror(errno));

// now fork child processes to try Nauty and SuperNOVA simultaneously
vector<pid_t> children;
Expand All @@ -347,34 +347,34 @@ namespace ecolab
// TODO: not sure that throwing an exception in these
// circumstances helps much
if (write(pipes[write_pipe], &r, sizeof(r))==-1)
throw error(strerror(errno));
throw error("%s", strerror(errno));

int w=0;
if (write(pipes[write_pipe], &w, sizeof(w))==-1)
throw error(strerror(errno));
throw error("%s", strerror(errno));

close(pipes[write_pipe]);
close(pipes[0]); close(pipes[1]);
exit(0);
}
else if (children.back() == -1)
throw error(strerror(errno));
throw error("%s", strerror(errno));

children.push_back(fork());
if (children.back()==0)
{
BitRep canon;
double r=canonical(canon,g); //SuperNOVA version
if (write(pipes[write_pipe], &r, sizeof(r))==-1)
throw error(strerror(errno));
throw error("%s", strerror(errno));
int w=1;
if (write(pipes[write_pipe], &w, sizeof(w))==-1)
throw error(strerror(errno));
throw error("%s", strerror(errno));
close(pipes[0]); close(pipes[1]);
exit(0);
}
else if (children.back() == -1)
throw error(strerror(errno));
throw error("%s", strerror(errno));

// Bliss (from igraph) produces errors occasionally. Until this is
// resolved, disable from the complexity calculation
Expand All @@ -387,23 +387,23 @@ namespace ecolab
// {
// double r=igraph_lnomega(g, method);
// if (write(pipes[write_pipe], &r, sizeof(r))==-1)
// throw error(strerror(errno));
// throw error("%s", strerror(errno));
// int w=1;
// if (write(pipes[write_pipe], &w, sizeof(w))==-1)
// throw error(strerror(errno));
// throw error("%s", strerror(errno));
// close(pipes[0]); close(pipes[1]);
// exit(0);
// }
// else if (children.back() == -1)
// throw error(strerror(errno));
// throw error("%s", strerror(errno));
// }
//#endif

double r;
int winner;
if (read(pipes[read_pipe],&r,sizeof(r))==-1 ||
read(pipes[read_pipe],&winner,sizeof(winner))==-1)
throw error(strerror(errno));
throw error("%s", strerror(errno));
for (size_t i=0; i<children.size(); ++i)
{
// cout << "killing pid: "<<children[i]<<endl;
Expand Down
Loading