input/file: make variables more local
This commit is contained in:
parent
19dd59f38c
commit
e4dd269609
@ -65,13 +65,10 @@ input_file_open(const char *filename,
|
|||||||
Mutex &mutex, Cond &cond,
|
Mutex &mutex, Cond &cond,
|
||||||
Error &error)
|
Error &error)
|
||||||
{
|
{
|
||||||
int fd, ret;
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
if (!PathTraitsFS::IsAbsolute(filename))
|
if (!PathTraitsFS::IsAbsolute(filename))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
fd = open_cloexec(filename, O_RDONLY|O_BINARY, 0);
|
const int fd = open_cloexec(filename, O_RDONLY|O_BINARY, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (errno != ENOENT && errno != ENOTDIR)
|
if (errno != ENOENT && errno != ENOTDIR)
|
||||||
error.FormatErrno("Failed to open \"%s\"",
|
error.FormatErrno("Failed to open \"%s\"",
|
||||||
@ -79,8 +76,8 @@ input_file_open(const char *filename,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fstat(fd, &st);
|
struct stat st;
|
||||||
if (ret < 0) {
|
if (fstat(fd, &st) < 0) {
|
||||||
error.FormatErrno("Failed to stat \"%s\"", filename);
|
error.FormatErrno("Failed to stat \"%s\"", filename);
|
||||||
close(fd);
|
close(fd);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user