goto out_fini_handler;
}
- ret = write(status_pipe, &status, sizeof(status));
- close(status_pipe);
- status_pipe = -1;
-
- if (sizeof(status) != ret) {
- SYSERROR("failed to write all of status");
- goto out_fini_handler;
- }
-
if (WIFEXITED(status)) {
char buf[4096];
close(pipes[0]);
+ ret = write(status_pipe, &status, sizeof(status));
+ close(status_pipe);
+ status_pipe = -1;
+
+ if (sizeof(status) != ret) {
+ SYSERROR("failed to write all of status");
+ goto out_fini_handler;
+ }
+
/*
* See comment in lxcapi_start; we don't care if these
* fail because it's just a beauty thing. We just
out:
if (status_pipe >= 0) {
- status = 1;
+ /* ensure getting here was a failure, e.g. if we failed to
+ * parse the child pid or something, even after a successful
+ * restore
+ */
+ if (!status)
+ status = 1;
if (write(status_pipe, &status, sizeof(status)) != sizeof(status)) {
SYSERROR("writing status failed");
}