daandemeyer / rpms / systemd

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