summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2013-01-17 17:04:38 -0800
committerJason Gerecke <killertofu@gmail.com>2013-01-23 11:23:00 -0800
commit59925bd45b714376b7f2ba07d0e443ed8db24861 (patch)
tree8bb75c06661e3acd665c8a68daa3069380babd18 /src
parent5d5be5106183961da2b1e793c4a62e59c1274e01 (diff)
NONE is not a valid action, and NULL a bad value
While the NONE Atom indicates that the driver should reset the action at the index it resides it, it is not *itself* a valid action. This patch prevents us from attempting to set NONE as an action. Signed-off-by: Jason Gerecke <killertofu@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/wcmXCommand.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 238454e..400babe 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -370,8 +370,13 @@ static int wcmCheckActionProperty(WacomDevicePtr priv, Atom property, XIProperty
int j;
if (!property) {
- DBG(5, priv, "WARNING: property == 0\n");
- return Success;
+ DBG(3, priv, "ERROR: Atom is NONE\n");
+ return BadMatch;
+ }
+
+ if (prop == NULL) {
+ DBG(3, priv, "ERROR: Value is NULL\n");
+ return BadMatch;
}
if (prop->size >= 255) {
@@ -456,7 +461,7 @@ static int wcmSetActionProperty(DeviceIntPtr dev, Atom property,
return rc;
}
- if (!checkonly && prop)
+ if (!checkonly)
{
memset(action, 0, sizeof(*action));
for (i = 0; i < prop->size; i++)
@@ -550,11 +555,13 @@ static int wcmSetActionsProperty(DeviceIntPtr dev, Atom property,
if (subproperty != handlers[index])
subproperty = handlers[index];
}
-
- XIGetDeviceProperty(dev, subproperty, &subprop);
- rc = wcmSetActionProperty(dev, subproperty, subprop, checkonly, &handlers[index], &actions[index]);
- if (rc != Success)
- return rc;
+ else
+ {
+ XIGetDeviceProperty(dev, subproperty, &subprop);
+ rc = wcmSetActionProperty(dev, subproperty, subprop, checkonly, &handlers[index], &actions[index]);
+ if (rc != Success)
+ return rc;
+ }
}
return Success;