richardphibel / rpms / systemd

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