fixed a bug when compiling with -DNDEBUG

This commit is contained in:
suter_a 2018-06-06 12:56:27 +02:00
parent 5540b628c1
commit 92f230e220

View File

@ -95,9 +95,16 @@ Extern void SUFFIX(cubafork)(Spin **pspin)
for( core = -spin->spec.naccel; core < spin->spec.ncores; ++core ) { for( core = -spin->spec.naccel; core < spin->spec.ncores; ++core ) {
int fd[2]; int fd[2];
pid_t pid; pid_t pid;
//as35 the next two if's fix the crash when compiling with -DNDEBUG
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fd) == -1)
assert(0);
if ((pid = fork()) == -1)
assert(0);
/*//as35 see comment just above
assert( assert(
socketpair(AF_LOCAL, SOCK_STREAM, 0, fd) != -1 && socketpair(AF_LOCAL, SOCK_STREAM, 0, fd) != -1 &&
(pid = fork()) != -1 ); (pid = fork()) != -1 );
*/
if( pid == 0 ) { if( pid == 0 ) {
close(fd[0]); close(fd[0]);
free(spin); free(spin);