mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-11 20:58:50 +03:00
cov: explicit ignore if failures
Here we can't do anything better than just ignore syscall failures (with silence as there is no loging mechanism)
This commit is contained in:
parent
79879bd201
commit
bc1976011a
@ -42,18 +42,18 @@ static bool _open_child(struct child_process *child, const char *cmd, const char
|
|||||||
|
|
||||||
child->pid = fork();
|
child->pid = fork();
|
||||||
if (child->pid < 0) {
|
if (child->pid < 0) {
|
||||||
close(pipe_fd[0]);
|
(void) close(pipe_fd[0]);
|
||||||
close(pipe_fd[1]);
|
(void) close(pipe_fd[1]);
|
||||||
_error("call to fork() failed: %d\n", r);
|
_error("call to fork() failed: %d\n", r);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child->pid == 0) {
|
if (child->pid == 0) {
|
||||||
// child
|
// child
|
||||||
close(pipe_fd[0]);
|
(void) close(pipe_fd[0]);
|
||||||
if (pipe_fd[1] != STDOUT_FILENO) {
|
if (pipe_fd[1] != STDOUT_FILENO) {
|
||||||
dup2(pipe_fd[1], STDOUT_FILENO);
|
(void) dup2(pipe_fd[1], STDOUT_FILENO);
|
||||||
close(pipe_fd[1]);
|
(void) close(pipe_fd[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (execv(cmd, (char *const *) argv) < 0)
|
if (execv(cmd, (char *const *) argv) < 0)
|
||||||
@ -62,7 +62,7 @@ static bool _open_child(struct child_process *child, const char *cmd, const char
|
|||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
// parent
|
// parent
|
||||||
close(pipe_fd[1]);
|
(void) close(pipe_fd[1]);
|
||||||
child->fp = fdopen(pipe_fd[0], "r");
|
child->fp = fdopen(pipe_fd[0], "r");
|
||||||
if (!child->fp) {
|
if (!child->fp) {
|
||||||
_error("call to fdopen() failed\n");
|
_error("call to fdopen() failed\n");
|
||||||
@ -78,7 +78,7 @@ static bool _close_child(struct child_process *child)
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
fclose(child->fp);
|
(void) fclose(child->fp);
|
||||||
|
|
||||||
while (waitpid(child->pid, &status, 0) < 0)
|
while (waitpid(child->pid, &status, 0) < 0)
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user