diff options
author | Max Kellermann <max@duempel.org> | 2013-08-10 18:02:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-04 18:14:22 +0200 |
commit | 29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch) | |
tree | 79766830b55ebca38ddbce84d8d548227eedb69e /src/ClientFile.cxx | |
parent | c9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff) | |
download | mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip |
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to '')
-rw-r--r-- | src/ClientFile.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ClientFile.cxx b/src/ClientFile.cxx index 69bc465b4..a460310be 100644 --- a/src/ClientFile.cxx +++ b/src/ClientFile.cxx @@ -21,9 +21,10 @@ #include "ClientFile.hxx" #include "Client.hxx" #include "protocol/Ack.hxx" -#include "io_error.h" #include "fs/Path.hxx" #include "fs/FileSystem.hxx" +#include "util/Error.hxx" +#include "util/Domain.hxx" #include <sys/stat.h> #include <sys/types.h> @@ -32,14 +33,13 @@ bool client_allow_file(const Client *client, const Path &path_fs, - GError **error_r) + Error &error) { #ifdef WIN32 (void)client; (void)path_fs; - g_set_error(error_r, ack_quark(), ACK_ERROR_PERMISSION, - "Access denied"); + error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied"); return false; #else const int uid = client_get_uid(client); @@ -50,21 +50,19 @@ client_allow_file(const Client *client, const Path &path_fs, if (uid <= 0) { /* unauthenticated client */ - g_set_error(error_r, ack_quark(), ACK_ERROR_PERMISSION, - "Access denied"); + error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied"); return false; } struct stat st; if (!StatFile(path_fs, st)) { - set_error_errno(error_r); + error.SetErrno(); return false; } if (st.st_uid != (uid_t)uid && (st.st_mode & 0444) != 0444) { /* client is not owner */ - g_set_error(error_r, ack_quark(), ACK_ERROR_PERMISSION, - "Access denied"); + error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied"); return false; } |