Skip to content

Avoid warning about result_fd being possibly uninitialized [blocks: #2310] #3313

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

Merged
merged 1 commit into from
Nov 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/util/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ using fdt = int;
/// open given file to replace either stdin, stderr, stdout
static fdt stdio_redirection(int fd, const std::string &file)
{
fdt result_fd;

#ifdef _WIN32
fdt result_fd = INVALID_HANDLE_VALUE;
std::string name;

SECURITY_ATTRIBUTES SecurityAttributes;
Expand Down Expand Up @@ -142,7 +141,7 @@ static fdt stdio_redirection(int fd, const std::string &file)
UNREACHABLE;
}

result_fd = open(file.c_str(), flags, mode);
const fdt result_fd = open(file.c_str(), flags, mode);

if(result_fd == -1)
perror(("Failed to open " + name + " file " + file).c_str());
Expand Down