summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@freedesktop.org>2008-08-03 13:24:49 +0200
committerEgbert Eich <eich@freedesktop.org>2008-08-03 13:24:49 +0200
commit3046799a06ecb79211ef0f4a2db9de4eec7233fb (patch)
tree63bdfd7a1f7266cd0a434616c375ffb1a6f89758
parent4dcc8ae1a6903434def1a2706f7c68ff9e2a17c4 (diff)
Fix for 64bit: feed a pointer to the right size variable to scanf().
XID is unsigned long, however %x in scanf takes a pointer to an unsigned int. Thus with XID xid, a sscanf(..., "0x%x", &xid) will most likely produce the wrong results.
-rw-r--r--xrandr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xrandr.c b/xrandr.c
index 41e15dd..b1e133e 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -425,13 +425,14 @@ set_name_all (name_t *name, name_t *old)
name->kind |= old->kind;
}
static void
set_name (name_t *name, char *string, name_kind_t valid)
{
- XID xid;
+ unsigned int xid; /* don't make it XID (which is unsigned long):
+ scanf() takes unsigned int */
int index;
if ((valid & name_xid) && sscanf (string, "0x%x", &xid) == 1)
set_name_xid (name, xid);
else if ((valid & name_index) && sscanf (string, "%d", &index) == 1)
set_name_index (name, index);