hal: Branch 'hal-0_5_8-branch'

Sjoerd Simons sjoerd at kemper.freedesktop.org
Wed Sep 27 12:31:30 PDT 2006


 hald/linux/osspec.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

New commits:
diff-tree 5cbbf1ca4fa93483373186c7a33eff02761137d8 (from e29998967c7d687581c780cb973b03bba3d41e62)
Author: Sjoerd Simons <sjoerd at luon.net>
Date:   Wed Sep 27 18:25:21 2006 +0200

    check if openfirmware.model is set before using it
    
    Check if the openfirmware.model string is actually set before using it. Also
    fix some code style issues David commented on.
    (cherry picked from 87aced5410449757026d61aee50d518976937806 commit)

diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
index a2a1998..1b322bb 100644
--- a/hald/linux/osspec.c
+++ b/hald/linux/osspec.c
@@ -473,7 +473,7 @@ set_suspend_hibernate_keys (HalDevice *d
 		can_hibernate = TRUE;
 	free (poweroptions);
 
-	if (!strcmp(hal_device_property_get_string(d, "power_management.type"), "pmu")) {
+	if (strcmp(hal_device_property_get_string(d, "power_management.type"), "pmu") == 0) {
 		/* We got our own helper for suspend PMU machines */
 		can_suspend = TRUE;
 	}
@@ -498,7 +498,8 @@ out:
 
 static void
 get_openfirmware_entry(HalDevice *d, char *property, char *entry, 
-                       gboolean multivalue) {
+                       gboolean multivalue) 
+{
 	char *contents;
 	gsize length;
 	if (!g_file_get_contents(entry, &contents, &length, NULL)) {
@@ -519,7 +520,8 @@ get_openfirmware_entry(HalDevice *d, cha
 }
 
 static void
-detect_openfirmware_formfactor(HalDevice *root) {
+detect_openfirmware_formfactor(HalDevice *root) 
+{
 	int x;
 	struct { gchar *model; gchar *formfactor; } model_formfactor[] =
 		{ 
@@ -534,7 +536,8 @@ detect_openfirmware_formfactor(HalDevice
 		};
 	const gchar *model =
 	  hal_device_property_get_string(root, "openfirmware.model");
-
+	if (model == NULL) 
+		return;
 	for (x = 0 ; model_formfactor[x].model ; x++) {
 		if (strstr(model, model_formfactor[x].model)) {
 			hal_device_property_set_string (root, "system.formfactor",
@@ -545,7 +548,8 @@ detect_openfirmware_formfactor(HalDevice
 }
 
 static void
-probe_openfirmware(HalDevice *root) {
+probe_openfirmware(HalDevice *root) 
+{
 #define DEVICE_TREE "/proc/device-tree/"
 	if (!g_file_test(DEVICE_TREE, G_FILE_TEST_IS_DIR)) {
 		return;


More information about the hal-commit mailing list