From 29030b54c98b0aee65fbc10ebf7ba36bed98c02c Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Sat, 10 Aug 2013 18:02:44 +0200
Subject: util/Error: new error passing library

Replaces GLib's GError.
---
 src/ClientFile.cxx | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

(limited to 'src/ClientFile.cxx')

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;
 	}
 
-- 
cgit v1.2.3