Diff between 906ba9c5550e451c66d2e9dfcf83e13cf17a06f4 and 2cf03cc88353613c06abca10dc633a6956b67b74

Changed Files

File Additions Deletions Status
plugins/neard.c +6 -19 modified

Full Patch

diff --git a/plugins/neard.c b/plugins/neard.c
index b0150e9..6272144 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -57,27 +57,14 @@ static gboolean agent_register_postpone = FALSE;
 
 static DBusMessage *error_reply(DBusMessage *msg, int error)
 {
-	switch (error) {
-	case ENOTSUP:
-		return g_dbus_create_error(msg, ERROR_INTERFACE ".NotSupported",
-						"Operation is not supported");
+	const char *name;
 
-	case ENOENT:
-		return g_dbus_create_error(msg, ERROR_INTERFACE ".NoSuchDevice",
-							"No such device");
-
-	case EINPROGRESS:
-		return g_dbus_create_error(msg, ERROR_INTERFACE ".InProgress",
-						"Operation already in progress");
-
-	case ENONET:
-		return g_dbus_create_error(msg, ERROR_INTERFACE ".Disabled",
-							"Device disabled");
+	if (error == EINPROGRESS)
+		name = ERROR_INTERFACE ".InProgress";
+	else
+		name = ERROR_INTERFACE ".Failed";
 
-	default:
-		return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
-							"%s", strerror(error));
-	}
+	return g_dbus_create_error(msg, name , "%s", strerror(error));
 }
 
 static void register_agent_cb(DBusPendingCall *call, void *user_data)