Merge pull request #3313 from tautschnig/vs-uninit
Avoid warning about result_fd being possibly uninitialized [blocks: #2310]
This commit is contained in:
commit
386ea88275
|
@ -53,9 +53,8 @@ using fdt = int;
|
||||||
/// open given file to replace either stdin, stderr, stdout
|
/// open given file to replace either stdin, stderr, stdout
|
||||||
static fdt stdio_redirection(int fd, const std::string &file)
|
static fdt stdio_redirection(int fd, const std::string &file)
|
||||||
{
|
{
|
||||||
fdt result_fd;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
fdt result_fd = INVALID_HANDLE_VALUE;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
SECURITY_ATTRIBUTES SecurityAttributes;
|
SECURITY_ATTRIBUTES SecurityAttributes;
|
||||||
|
@ -142,7 +141,7 @@ static fdt stdio_redirection(int fd, const std::string &file)
|
||||||
UNREACHABLE;
|
UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
result_fd = open(file.c_str(), flags, mode);
|
const fdt result_fd = open(file.c_str(), flags, mode);
|
||||||
|
|
||||||
if(result_fd == -1)
|
if(result_fd == -1)
|
||||||
perror(("Failed to open " + name + " file " + file).c_str());
|
perror(("Failed to open " + name + " file " + file).c_str());
|
||||||
|
|
Loading…
Reference in New Issue