diff options
author | Max Kellermann <max@duempel.org> | 2015-02-28 20:42:50 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-02-28 23:00:26 +0100 |
commit | 90a61b6babe3528efd982511790057e1e1e39b81 (patch) | |
tree | cae3a8072a056118865a988042e1f1269d11e277 /src/client | |
parent | 00583bc4a8357cf43930151650dc058225675403 (diff) | |
download | mpd-90a61b6babe3528efd982511790057e1e1e39b81.tar.gz mpd-90a61b6babe3528efd982511790057e1e1e39b81.tar.xz mpd-90a61b6babe3528efd982511790057e1e1e39b81.zip |
fs/FileInfo: new library providing GetFileInfo()
Replaces StatFile(), with a portable data object.
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ClientFile.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/client/ClientFile.cxx b/src/client/ClientFile.cxx index 9bf977704..72e9d9931 100644 --- a/src/client/ClientFile.cxx +++ b/src/client/ClientFile.cxx @@ -21,7 +21,7 @@ #include "Client.hxx" #include "protocol/Ack.hxx" #include "fs/Path.hxx" -#include "fs/FileSystem.hxx" +#include "fs/FileInfo.hxx" #include "util/Error.hxx" #include <sys/stat.h> @@ -47,13 +47,11 @@ Client::AllowFile(Path path_fs, Error &error) const return false; } - struct stat st; - if (!StatFile(path_fs, st)) { - error.SetErrno(); + FileInfo fi; + if (!GetFileInfo(path_fs, fi, error)) return false; - } - if (st.st_uid != (uid_t)uid && (st.st_mode & 0444) != 0444) { + if (fi.GetUid() != (uid_t)uid && (fi.GetMode() & 0444) != 0444) { /* client is not owner */ error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied"); return false; |