diff options
author | Max Kellermann <max@duempel.org> | 2014-10-02 19:18:58 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-10-02 19:18:58 +0200 |
commit | e4dd26960947f6a332d32bea655dc4e7d63fe012 (patch) | |
tree | b5ee0d50667910a9ac2cfe6e04f376f9988f56e2 /src/input | |
parent | 19dd59f38c7aa07b0290ef22cac9fd7266b92042 (diff) | |
download | mpd-e4dd26960947f6a332d32bea655dc4e7d63fe012.tar.gz mpd-e4dd26960947f6a332d32bea655dc4e7d63fe012.tar.xz mpd-e4dd26960947f6a332d32bea655dc4e7d63fe012.zip |
input/file: make variables more local
Diffstat (limited to '')
-rw-r--r-- | src/input/plugins/FileInputPlugin.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/input/plugins/FileInputPlugin.cxx b/src/input/plugins/FileInputPlugin.cxx index 8dd114999..525786b5d 100644 --- a/src/input/plugins/FileInputPlugin.cxx +++ b/src/input/plugins/FileInputPlugin.cxx @@ -65,13 +65,10 @@ input_file_open(const char *filename, Mutex &mutex, Cond &cond, Error &error) { - int fd, ret; - struct stat st; - if (!PathTraitsFS::IsAbsolute(filename)) 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 (errno != ENOENT && errno != ENOTDIR) error.FormatErrno("Failed to open \"%s\"", @@ -79,8 +76,8 @@ input_file_open(const char *filename, return nullptr; } - ret = fstat(fd, &st); - if (ret < 0) { + struct stat st; + if (fstat(fd, &st) < 0) { error.FormatErrno("Failed to stat \"%s\"", filename); close(fd); return nullptr; |