提交 a3bc393e 编写于 作者: E Eric Blake

maint: command.c whitespace cleanups

Noticed during the previous commit.

* src/util/command.c: Fix some spacing and break long lines.
上级 858c2476
...@@ -1803,7 +1803,7 @@ virCommandProcessIO(virCommandPtr cmd, int *inpipe) ...@@ -1803,7 +1803,7 @@ virCommandProcessIO(virCommandPtr cmd, int *inpipe)
if (VIR_CLOSE(*inpipe) < 0) if (VIR_CLOSE(*inpipe) < 0)
VIR_DEBUG("ignoring failed close on fd %d", infd); VIR_DEBUG("ignoring failed close on fd %d", infd);
infd = -1; infd = -1;
} else if (errno != EINTR && errno != EAGAIN) { } else if (errno != EINTR && errno != EAGAIN) {
virReportSystemError(errno, "%s", virReportSystemError(errno, "%s",
_("unable to write to child input")); _("unable to write to child input"));
goto cleanup; goto cleanup;
...@@ -2053,9 +2053,11 @@ virCommandHook(void *data) ...@@ -2053,9 +2053,11 @@ virCommandHook(void *data)
if (cmd->handshake) { if (cmd->handshake) {
char c = res < 0 ? '0' : '1'; char c = res < 0 ? '0' : '1';
int rv; int rv;
VIR_DEBUG("Notifying parent for handshake start on %d", cmd->handshakeWait[1]); VIR_DEBUG("Notifying parent for handshake start on %d",
cmd->handshakeWait[1]);
if (safewrite(cmd->handshakeWait[1], &c, sizeof(c)) != sizeof(c)) { if (safewrite(cmd->handshakeWait[1], &c, sizeof(c)) != sizeof(c)) {
virReportSystemError(errno, "%s", _("Unable to notify parent process")); virReportSystemError(errno, "%s",
_("Unable to notify parent process"));
return -1; return -1;
} }
...@@ -2068,22 +2070,29 @@ virCommandHook(void *data) ...@@ -2068,22 +2070,29 @@ virCommandHook(void *data)
_("Unknown failure during hook execution"); _("Unknown failure during hook execution");
size_t len = strlen(msg) + 1; size_t len = strlen(msg) + 1;
if (safewrite(cmd->handshakeWait[1], msg, len) != len) { if (safewrite(cmd->handshakeWait[1], msg, len) != len) {
virReportSystemError(errno, "%s", _("Unable to send error to parent process")); virReportSystemError(errno, "%s",
_("Unable to send error to parent"));
return -1; return -1;
} }
return -1; return -1;
} }
VIR_DEBUG("Waiting on parent for handshake complete on %d", cmd->handshakeNotify[0]); VIR_DEBUG("Waiting on parent for handshake complete on %d",
if ((rv = saferead(cmd->handshakeNotify[0], &c, sizeof(c))) != sizeof(c)) { cmd->handshakeNotify[0]);
if ((rv = saferead(cmd->handshakeNotify[0], &c,
sizeof(c))) != sizeof(c)) {
if (rv < 0) if (rv < 0)
virReportSystemError(errno, "%s", _("Unable to wait on parent process")); virReportSystemError(errno, "%s",
_("Unable to wait on parent process"));
else else
virReportSystemError(EIO, "%s", _("libvirtd quit during handshake")); virReportSystemError(EIO, "%s",
_("libvirtd quit during handshake"));
return -1; return -1;
} }
if (c != '1') { if (c != '1') {
virReportSystemError(EINVAL, _("Unexpected confirm code '%c' from parent process"), c); virReportSystemError(EINVAL,
_("Unexpected confirm code '%c' from parent"),
c);
return -1; return -1;
} }
VIR_FORCE_CLOSE(cmd->handshakeWait[1]); VIR_FORCE_CLOSE(cmd->handshakeWait[1]);
...@@ -2482,9 +2491,11 @@ int virCommandHandshakeWait(virCommandPtr cmd) ...@@ -2482,9 +2491,11 @@ int virCommandHandshakeWait(virCommandPtr cmd)
VIR_DEBUG("Wait for handshake on %d", cmd->handshakeWait[0]); VIR_DEBUG("Wait for handshake on %d", cmd->handshakeWait[0]);
if ((rv = saferead(cmd->handshakeWait[0], &c, sizeof(c))) != sizeof(c)) { if ((rv = saferead(cmd->handshakeWait[0], &c, sizeof(c))) != sizeof(c)) {
if (rv < 0) if (rv < 0)
virReportSystemError(errno, "%s", _("Unable to wait for child process")); virReportSystemError(errno, "%s",
_("Unable to wait for child process"));
else else
virReportSystemError(EIO, "%s", _("Child process quit during startup handshake")); virReportSystemError(EIO, "%s",
_("Child quit during startup handshake"));
VIR_FORCE_CLOSE(cmd->handshakeWait[0]); VIR_FORCE_CLOSE(cmd->handshakeWait[0]);
return -1; return -1;
} }
...@@ -2499,7 +2510,8 @@ int virCommandHandshakeWait(virCommandPtr cmd) ...@@ -2499,7 +2510,8 @@ int virCommandHandshakeWait(virCommandPtr cmd)
if ((len = saferead(cmd->handshakeWait[0], msg, 1024)) < 0) { if ((len = saferead(cmd->handshakeWait[0], msg, 1024)) < 0) {
VIR_FORCE_CLOSE(cmd->handshakeWait[0]); VIR_FORCE_CLOSE(cmd->handshakeWait[0]);
VIR_FREE(msg); VIR_FREE(msg);
virReportSystemError(errno, "%s", _("No error message from child failure")); virReportSystemError(errno, "%s",
_("No error message from child failure"));
return -1; return -1;
} }
VIR_FORCE_CLOSE(cmd->handshakeWait[0]); VIR_FORCE_CLOSE(cmd->handshakeWait[0]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册