setcontext(&savedUserSnapshotContext);
}
} else {
- int status;
- int retVal;
-
- DEBUG("The process id of child is %d and the process id of this process is %d and snapshot id is %d\n",
- forkedID, getpid(), snapshotid);
-
- do {
- retVal = waitpid(forkedID, &status, 0);
- } while (-1 == retVal && errno == EINTR);
+ DEBUG("parent PID: %d, child PID: %d, snapshot ID: %d\n",
+ getpid(), forkedID, snapshotid);
+
+ while (waitpid(forkedID, NULL, 0) < 0) {
+ /* waitpid() may be interrupted */
+ if (errno != EINTR) {
+ perror("waitpid");
+ exit(EXIT_FAILURE);
+ }
+ }
- if (fork_snap->mIDToRollback != snapshotid) {
+ if (fork_snap->mIDToRollback != snapshotid)
exit(EXIT_SUCCESS);
- }
rollback = true;
}
}