summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Kukawka <danny.kukawka@web.de>2009-01-22 16:21:11 +0100
committerDanny Kukawka <danny.kukawka@web.de>2009-01-22 16:21:11 +0100
commit145e53da57517b9b70eabe6e104668279286cf0a (patch)
treea7fd4e58285cae20bff2e680c08f0369000b44b6
parent8b56ff46e57bb9b5cb7d923c21b8c98cd19d487e (diff)
add some parameter checks to hal_util_*et_driver*() functions
Added some parameter checks and debug messages to hal_util_get_driver_name() and hal_util_set_driver().
-rw-r--r--hald/linux/osspec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
index 0902b149..f75d88a9 100644
--- a/hald/linux/osspec.c
+++ b/hald/linux/osspec.c
@@ -891,6 +891,11 @@ hal_util_get_driver_name (const char *sysfs_path, gchar *driver_name)
gchar driver_path[HAL_PATH_MAX];
struct stat statbuf;
+ if (sysfs_path == NULL) {
+ HAL_WARNING (("hal_util_get_driver_name: sysfs_path == NULL"));
+ return FALSE;
+ }
+
g_snprintf (driver_path, sizeof (driver_path), "%s/driver", sysfs_path);
if (stat (driver_path, &statbuf) == 0) {
gchar buf[256];
@@ -909,6 +914,11 @@ hal_util_set_driver (HalDevice *d, const char *property_name, const char *sysfs_
gboolean ret;
gchar driver_name[256];
+ if (d == NULL || property_name == NULL || sysfs_path == NULL) {
+ HAL_WARNING (("hal_util_set_driver: d, property_name or sysfs_path == NULL"));
+ return FALSE;
+ }
+
memset (driver_name, '\0', sizeof (driver_name));
ret = hal_util_get_driver_name (sysfs_path, driver_name);
if (ret == TRUE)