Change-Id: I41d0125dbbd8552f044add81b345a04a0f4fe8ac
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
close(spipe[0]);
/* wait the ready signal (that transmit the slave pid) */
rc = read(mpipe[0], &children[1], sizeof children[1]);
close(spipe[0]);
/* wait the ready signal (that transmit the slave pid) */
rc = read(mpipe[0], &children[1], sizeof children[1]);
+ close(mpipe[0]);
+ if (rc <= 0) {
ERROR("reading master pipe failed: %m");
ERROR("reading master pipe failed: %m");
close(spipe[1]);
return -1;
}
close(spipe[1]);
return -1;
}
assert(rc == sizeof children[1]);
/* start the child */
rc = write(spipe[1], "start", 5);
assert(rc == sizeof children[1]);
/* start the child */
rc = write(spipe[1], "start", 5);
/********* in the slave child ************/
close(mpipe[0]);
rc = read(spipe[0], message, sizeof message);
/********* in the slave child ************/
close(mpipe[0]);
rc = read(spipe[0], message, sizeof message);
ERROR("reading slave pipe failed: %m");
_exit(1);
}
ERROR("reading slave pipe failed: %m");
_exit(1);
}
}
else {
rc = write(mpipe[1], &children[1], sizeof children[1]);
}
else {
rc = write(mpipe[1], &children[1], sizeof children[1]);
ERROR("can't write master pipe: %m");
}
else {
ERROR("can't write master pipe: %m");
}
else {