hal: Branch 'master' - 2 commits
David Zeuthen
david at kemper.freedesktop.org
Mon Jul 2 15:52:13 PDT 2007
hald/linux/osspec.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
New commits:
diff-tree 1ea4c66304e52b697bdd308ab32bb766ad786bc7 (from parents)
Merge: eea8c525243e6ef842f8f91ac2a3665220c74320 e8a22c066d0e1b6861e801fe9a517ddaef568708
Author: David Zeuthen <davidz at redhat.com>
Date: Mon Jul 2 18:51:32 2007 -0400
Merge branch 'master' of ssh://david@git.freedesktop.org/git/hal
diff-tree eea8c525243e6ef842f8f91ac2a3665220c74320 (from 0d6f53e362552899648467c22c767570b0825029)
Author: Daniel Drake <dsd at gentoo.org>
Date: Fri Jun 22 22:54:58 2007 +0100
[PATCH] don't die if /proc/mdstat doesn't exist
The recent commit to add MD support causes HAL to exit early during
startup if /proc/mdstat isn't watchable.
This breaks HAL on my system which runs a kernel without MD support at
all, so /proc/mdstat doesn't exist.
Allow the NOENT error but continue to bail out on other conditions.
diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
index f70f056..9fc2ce3 100644
--- a/hald/linux/osspec.c
+++ b/hald/linux/osspec.c
@@ -297,6 +297,8 @@ GIOChannel *get_mdstat_channel (void)
void
osspec_privileged_init (void)
{
+ GError *err = NULL;
+
file_monitor = hal_file_monitor_new ();
if (file_monitor == NULL) {
DIE (("Cannot initialize file monitor"));
@@ -305,10 +307,20 @@ osspec_privileged_init (void)
/* watch /proc/mdstat for md changes
* kernel 2.6.19 throws a POLLPRI event for every change
*/
- mdstat_channel = g_io_channel_new_file ("/proc/mdstat", "r", NULL);
- if (mdstat_channel == NULL)
- DIE (("Unable to read /proc/mdstat"));
- g_io_add_watch (mdstat_channel, G_IO_PRI, mdstat_changed_event, NULL);
+ mdstat_channel = g_io_channel_new_file ("/proc/mdstat", "r", &err);
+ if (mdstat_channel != NULL) {
+ g_io_add_watch (mdstat_channel, G_IO_PRI, mdstat_changed_event, NULL);
+ } else {
+ if (err != NULL)
+ HAL_WARNING (("Unable to open /proc/mdstat: %s", err->message));
+
+ /* if its not a reasonable error, abort */
+ if (!g_error_matches (err, G_FILE_ERROR, G_FILE_ERROR_NOENT))
+ DIE (("Unable to read /proc/mdstat"));
+ }
+
+ if (err != NULL)
+ g_error_free (err);
}
void
More information about the hal-commit
mailing list