richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
9fc0f6
From 4b2a44e3fa0e56b638dab29def3f499788a03334 Mon Sep 17 00:00:00 2001
9fc0f6
From: Martin Pitt <martinpitt@gnome.org>
9fc0f6
Date: Mon, 4 Nov 2013 07:25:45 +0100
9fc0f6
Subject: [PATCH] udev-builtin-keyboard: Fix large scan codes on 32 bit
9fc0f6
 architectures
9fc0f6
9fc0f6
Use strtoul(), as scan codes are always positive. On 32 bit architectures
9fc0f6
strtol gives wrong results:
9fc0f6
9fc0f6
  strtol("fffffff0", &endptr, 16)
9fc0f6
9fc0f6
returns 2147483647 instead of 4294967280.
9fc0f6
9fc0f6
https://launchpad.net/bugs/1247676
9fc0f6
---
9fc0f6
 src/udev/udev-builtin-keyboard.c | 2 +-
9fc0f6
 1 file changed, 1 insertion(+), 1 deletion(-)
9fc0f6
9fc0f6
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
9fc0f6
index ddd8535..8f457ab 100644
9fc0f6
--- a/src/udev/udev-builtin-keyboard.c
9fc0f6
+++ b/src/udev/udev-builtin-keyboard.c
9fc0f6
@@ -88,7 +88,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
9fc0f6
                         continue;
9fc0f6
 
9fc0f6
                 /* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
9fc0f6
-                scancode = strtol(key + 13, &endptr, 16);
9fc0f6
+                scancode = strtoul(key + 13, &endptr, 16);
9fc0f6
                 if (endptr[0] != '\0') {
9fc0f6
                         log_error("Error, unable to parse scan code from '%s'\n", key);
9fc0f6
                         continue;