Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1532: Fixed leaking duplicate file descriptor #1533

Closed
wants to merge 1 commit into from

Conversation

ganeshmurthy
Copy link
Contributor

No description provided.

@ganeshmurthy ganeshmurthy linked an issue Jun 24, 2024 that may be closed by this pull request
if (dup(fd) < 0) fail(pipefd[1], "Can't redirect stdout to /dev/null");
if (dup(fd) < 0) fail(pipefd[1], "Can't redirect stderr /dev/null");

int fd1 = dup(fd);

Check warning

Code scanning / GNU C11

'dup' on possibly invalid file descriptor 'fd' Warning

'dup' on possibly invalid file descriptor 'fd'
}
close(fd1);

int fd2 = dup(fd);

Check warning

Code scanning / GNU C11

'dup' on possibly invalid file descriptor 'fd' Warning

'dup' on possibly invalid file descriptor 'fd'
close(fd1);
fail(pipefd[1], "Can't redirect stdout to /dev/null");
}
close(fd1);

Check warning

Code scanning / GNU C11

double 'close' of file descriptor 'fd1' Warning

double 'close' of file descriptor 'fd1'
close(fd2);
fail(pipefd[1], "Can't redirect stderr /dev/null");
}
close(fd2);

Check warning

Code scanning / GNU C11

double 'close' of file descriptor 'fd2' Warning

double 'close' of file descriptor 'fd2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coverity issue: Leaking file descriptor in main.c
1 participant