From 14ba4385bceb48593400471424d2b4c169b901da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Mon, 12 Jan 1998 01:41:52 +0100
Subject: [PATCH] * Requests.pmod (GetProperty): Fixed error handling, I hope.

Rev: lib/modules/Protocols.pmod/X.pmod/Requests.pmod:1.13
---
 lib/modules/Protocols.pmod/X.pmod/Requests.pmod | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/modules/Protocols.pmod/X.pmod/Requests.pmod b/lib/modules/Protocols.pmod/X.pmod/Requests.pmod
index 1ebac5b247..03b6d288d4 100644
--- a/lib/modules/Protocols.pmod/X.pmod/Requests.pmod
+++ b/lib/modules/Protocols.pmod/X.pmod/Requests.pmod
@@ -326,6 +326,16 @@ class GetProperty
     
     sscanf(reply->rest, "%4c%4c%4c",
 	   m->type, m->bytesAfter, length);
+    
+    /* Match and Property errors (as in rfc-1013) are not used,
+     * according to the official specification. For non-existent
+     * properties, format == 0 is returned.
+     *
+     * If types doesn't match, format is non-zero, the actual type is
+     * returned, but the data is empty (length = 0). */
+     
+    if ( (!m->format) || (type && (type != m->type)))
+      return 0;
     switch(m->format)
       {
       case 8:
@@ -359,8 +369,6 @@ class GetProperty
      * unexpected type, or too short, return 0 */
     switch (reply->errorCode)
       {
-      case "Property":
-      case "Match":
       case "Value":
 	return 0;
       case "Atom":
-- 
GitLab