aboutsummaryrefslogtreecommitdiff
path: root/modules/devices/inputdevices.c
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2010-08-15 18:36:25 -0300
committerLeandro Pereira <leandro@hardinfo.org>2010-08-15 18:36:25 -0300
commit9fda18663f31e67d8c1c50e1c5a1888abceda2a6 (patch)
treea680bd9c701eaec1016d6beb28bf2c79cfc538e0 /modules/devices/inputdevices.c
parent9fe6a457e1d9d01f6645d91805691afd429d0a2c (diff)
Fix potential problems found by clang static analyzer.
Diffstat (limited to 'modules/devices/inputdevices.c')
-rw-r--r--modules/devices/inputdevices.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/devices/inputdevices.c b/modules/devices/inputdevices.c
index c280e218..31f51fbb 100644
--- a/modules/devices/inputdevices.c
+++ b/modules/devices/inputdevices.c
@@ -46,7 +46,7 @@ __scan_input_devices(void)
FILE *dev;
gchar buffer[128];
gchar *tmp, *name = NULL, *phys = NULL;
- gint bus, vendor, product, version;
+ gint bus = 0, vendor, product, version;
int d = 0, n = 0;
dev = fopen("/proc/bus/input/devices", "r");
@@ -87,7 +87,7 @@ __scan_input_devices(void)
d = 4; //INPUT_UNKNOWN;
break;
case '\n':
- if (strstr(name, "PC Speaker")) {
+ if (name && strstr(name, "PC Speaker")) {
d = 3; // INPUT_PCSPKR
}
@@ -123,12 +123,12 @@ __scan_input_devices(void)
"Version=0x%x\n",
strhash, product, version);
- if (phys[1] != 0) {
+ if (phys && phys[1] != 0) {
strhash = h_strdup_cprintf("Connected to=%s\n",
strhash, phys);
}
- if (strstr(phys,"ir")) {
+ if (phys && strstr(phys, "ir")) {
strhash = h_strdup_cprintf("InfraRed port=yes\n",
strhash);
}