[Pkg-utopia-commits] r536 - in packages/unstable/hal/debian: .
patches
Sjoerd Simons
sjoerd at costa.debian.org
Wed Feb 1 22:30:45 UTC 2006
Author: sjoerd
Date: 2006-02-01 22:30:09 +0000 (Wed, 01 Feb 2006)
New Revision: 536
Modified:
packages/unstable/hal/debian/changelog
packages/unstable/hal/debian/control
packages/unstable/hal/debian/hal.postinst
packages/unstable/hal/debian/hal.preinst
packages/unstable/hal/debian/hal.udev.rules
packages/unstable/hal/debian/patches/01_hal_privsep.patch
Log:
ENV{UDEVD_EVENT}=="1" isn\'t needed anymore
Modified: packages/unstable/hal/debian/changelog
===================================================================
--- packages/unstable/hal/debian/changelog 2006-02-01 21:41:08 UTC (rev 535)
+++ packages/unstable/hal/debian/changelog 2006-02-01 22:30:09 UTC (rev 536)
@@ -1,3 +1,16 @@
+hal (0.5.6-2) unstable; urgency=low
+
+ * debian/patches/01_hal_privsep.patch
+ + Updated to current CVS version
+ * udev communicated events to hal via a socket now, which as a side-effect
+ fixes incompatibility with udev 0.83 (Closes: #350639, #350762)
+ * Let hal look in the right location for the pci.ids and usb.ids files
+ (Closes: #341824)
+ * Because the addons run with root privs. now, harddisk properties are
+ available (Closes: #290653)
+
+ -- Sjoerd Simons <sjoerd at debian.org> Wed, 1 Feb 2006 23:07:21 +0100
+
hal (0.5.6-1) experimental; urgency=low
* New upstream release
Modified: packages/unstable/hal/debian/control
===================================================================
--- packages/unstable/hal/debian/control 2006-02-01 21:41:08 UTC (rev 535)
+++ packages/unstable/hal/debian/control 2006-02-01 22:30:09 UTC (rev 536)
@@ -7,7 +7,7 @@
Package: hal
Architecture: any
-Depends: ${shlibs:Depends}, adduser, pciutils, usbutils, udev (>= 0.063), dbus (>= 0.60-1), lsb-base
+Depends: ${shlibs:Depends}, adduser, pciutils, usbutils, udev (>= 0.065), dbus (>= 0.60-1), lsb-base
Suggests: hal-device-manager
Description: Hardware Abstraction Layer
HAL provides an abstract view on hardware.
Modified: packages/unstable/hal/debian/hal.postinst
===================================================================
--- packages/unstable/hal/debian/hal.postinst 2006-02-01 21:41:08 UTC (rev 535)
+++ packages/unstable/hal/debian/hal.postinst 2006-02-01 22:30:09 UTC (rev 536)
@@ -38,12 +38,9 @@
update-rc.d hal remove
fi
- # only start hal if it is not already running
- if [ ! -e /var/run/hal/hald.pid ] || ! ps --no-headers -p $(cat /var/run/hal/hald.pid) > /dev/null ; then
- if [ -x /etc/init.d/dbus ]; then
- invoke-rc.d dbus reload || true
- /etc/dbus-1/event.d/20hal start || true
- fi
+ if [ -x /etc/init.d/dbus ]; then
+ invoke-rc.d dbus reload || true
+ /etc/dbus-1/event.d/20hal start || true
fi
Modified: packages/unstable/hal/debian/hal.preinst
===================================================================
--- packages/unstable/hal/debian/hal.preinst 2006-02-01 21:41:08 UTC (rev 535)
+++ packages/unstable/hal/debian/hal.preinst 2006-02-01 22:30:09 UTC (rev 536)
@@ -23,6 +23,9 @@
if dpkg --compare-versions "$2" le "0.5.2-1"; then
rm_conffile "/etc/dev.d/block/hal-unmount.dev"
fi
+ if dpkg --compare-versions "$2" le "0.5.6-2"; then
+ rm_conffile "/etc/udev/scripts/device-removable.sh"
+ fi
esac
Modified: packages/unstable/hal/debian/hal.udev.rules
===================================================================
--- packages/unstable/hal/debian/hal.udev.rules 2006-02-01 21:41:08 UTC (rev 535)
+++ packages/unstable/hal/debian/hal.udev.rules 2006-02-01 22:30:09 UTC (rev 536)
@@ -2,4 +2,4 @@
RUN+="socket:/org/freedesktop/hal/udev_event"
# unmount block devices when they are removed
-ENV{UDEVD_EVENT}=="1", SUBSYSTEM=="block",ACTION="remove", RUN+="/usr/lib/hal/hal-unmount.sh"
+SUBSYSTEM=="block",ACTION="remove", RUN+="/usr/lib/hal/hal-unmount.sh"
Modified: packages/unstable/hal/debian/patches/01_hal_privsep.patch
===================================================================
--- packages/unstable/hal/debian/patches/01_hal_privsep.patch 2006-02-01 21:41:08 UTC (rev 535)
+++ packages/unstable/hal/debian/patches/01_hal_privsep.patch 2006-02-01 22:30:09 UTC (rev 536)
@@ -1,6 +1,6 @@
diff -ruN hal-0.5.6-old/Makefile.am hal-0.5.6/Makefile.am
--- hal-0.5.6-old/Makefile.am 2005-08-26 22:27:21.000000000 +0200
-+++ hal-0.5.6/Makefile.am 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/Makefile.am 2006-02-01 22:49:25.000000000 +0100
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
@@ -13,7 +13,7 @@
pkgconfig_DATA = hal.pc hal-storage.pc
diff -ruN hal-0.5.6-old/Makefile.in hal-0.5.6/Makefile.in
--- hal-0.5.6-old/Makefile.in 2006-01-17 02:07:51.000000000 +0100
-+++ hal-0.5.6/Makefile.in 2006-01-20 11:28:38.000000000 +0100
++++ hal-0.5.6/Makefile.in 2006-02-01 22:49:58.000000000 +0100
@@ -295,8 +295,8 @@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
@@ -27,7 +27,7 @@
pkgconfig_DATA = hal.pc hal-storage.pc
diff -ruN hal-0.5.6-old/configure hal-0.5.6/configure
--- hal-0.5.6-old/configure 2006-01-17 01:26:24.000000000 +0100
-+++ hal-0.5.6/configure 2006-01-20 11:28:00.000000000 +0100
++++ hal-0.5.6/configure 2006-02-01 22:40:28.000000000 +0100
@@ -1201,7 +1201,7 @@
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
@@ -994,18 +994,18 @@
- ac_config_files="$ac_config_files hal.pc hal-storage.pc hal.conf Makefile hald/Makefile hald/dummy/Makefile hald/linux2/Makefile hald/linux2/probing/Makefile hald/linux2/addons/Makefile hald/solaris/Makefile hald/haldaemon libhal/Makefile libhal-storage/Makefile tools/Makefile tools/fstab-sync.8 tools/linux/Makefile tools/device-manager/hal-device-manager tools/device-manager/Makefile tools/device-manager/Const.py fdi/Makefile fdi/preprobe/Makefile fdi/preprobe/10osvendor/Makefile fdi/preprobe/20thirdparty/Makefile fdi/preprobe/30user/Makefile fdi/information/Makefile fdi/information/10freedesktop/Makefile fdi/information/20thirdparty/Makefile fdi/information/30user/Makefile fdi/policy/Makefile fdi/policy/10osvendor/Makefile fdi/policy/20thirdparty/Makefile fdi/policy/30user/Makefile doc/Makefile doc/api/Makefile doc/api/Doxyfile doc/conf/Makefile doc/spec/Makefile doc/spec/hal-spec.xml examples/Makefile examples/volumed/Makefile po/Makefile.in drive_id/Makefile volume_id/Makefile tools/hal-luks-setup tools/hal-luks-remove"
-+ ac_config_files="$ac_config_files hal.pc hal-storage.pc hal.conf Makefile hald/Makefile hald/dummy/Makefile hald/linux2/Makefile hald/linux2/probing/Makefile hald/linux2/addons/Makefile hald/solaris/Makefile hald/haldaemon hald-runner/Makefile libhal/Makefile libhal-storage/Makefile tools/Makefile tools/fstab-sync.8 tools/linux/Makefile tools/device-manager/hal-device-manager tools/device-manager/Makefile tools/device-manager/Const.py fdi/Makefile fdi/preprobe/Makefile fdi/preprobe/10osvendor/Makefile fdi/preprobe/20thirdparty/Makefile fdi/preprobe/30user/Makefile fdi/information/Makefile fdi/information/10freedesktop/Makefile fdi/information/20thirdparty/Makefile fdi/information/30user/Makefile fdi/policy/Makefile fdi/policy/10osvendor/Makefile fdi/policy/20thirdparty/Makefile fdi/policy/30user/Makefile doc/Makefile doc/api/Makefile doc/api/Doxyfile doc/conf/Makefile doc/spec/Makefile doc/spec/hal-spec.xml examples/Makefile examples/volumed/Makefile po/Makefile.in drive_id/Makefile volume_id/Makefile tools/hal-luks-setup tools/hal-luks-remove"
++ ac_config_files="$ac_config_files hal.pc hal-storage.pc hal.conf Makefile hald/Makefile hald-runner/Makefile hald/dummy/Makefile hald/linux2/Makefile hald/linux2/probing/Makefile hald/linux2/addons/Makefile hald/solaris/Makefile hald/haldaemon libhal/Makefile libhal-storage/Makefile tools/Makefile tools/fstab-sync.8 tools/linux/Makefile tools/device-manager/hal-device-manager tools/device-manager/Makefile tools/device-manager/Const.py fdi/Makefile fdi/preprobe/Makefile fdi/preprobe/10osvendor/Makefile fdi/preprobe/20thirdparty/Makefile fdi/preprobe/30user/Makefile fdi/information/Makefile fdi/information/10freedesktop/Makefile fdi/information/20thirdparty/Makefile fdi/information/30user/Makefile fdi/policy/Makefile fdi/policy/10osvendor/Makefile fdi/policy/20thirdparty/Makefile fdi/policy/30user/Makefile doc/Makefile doc/api/Makefile doc/api/Doxyfile doc/conf/Makefile doc/spec/Makefile doc/spec/hal-spec.xml examples/Makefile examples/volumed/Makefile po/Makefile.in drive_id/Makefile volume_id/Makefile tools/hal-luks-setup tools/hal-luks-remove"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
-@@ -25760,6 +25686,7 @@
- "hald/linux2/addons/Makefile" ) CONFIG_FILES="$CONFIG_FILES hald/linux2/addons/Makefile" ;;
- "hald/solaris/Makefile" ) CONFIG_FILES="$CONFIG_FILES hald/solaris/Makefile" ;;
- "hald/haldaemon" ) CONFIG_FILES="$CONFIG_FILES hald/haldaemon" ;;
+@@ -25754,6 +25680,7 @@
+ "hal.conf" ) CONFIG_FILES="$CONFIG_FILES hal.conf" ;;
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "hald/Makefile" ) CONFIG_FILES="$CONFIG_FILES hald/Makefile" ;;
+ "hald-runner/Makefile" ) CONFIG_FILES="$CONFIG_FILES hald-runner/Makefile" ;;
- "libhal/Makefile" ) CONFIG_FILES="$CONFIG_FILES libhal/Makefile" ;;
- "libhal-storage/Makefile" ) CONFIG_FILES="$CONFIG_FILES libhal-storage/Makefile" ;;
- "tools/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
+ "hald/dummy/Makefile" ) CONFIG_FILES="$CONFIG_FILES hald/dummy/Makefile" ;;
+ "hald/linux2/Makefile" ) CONFIG_FILES="$CONFIG_FILES hald/linux2/Makefile" ;;
+ "hald/linux2/probing/Makefile" ) CONFIG_FILES="$CONFIG_FILES hald/linux2/probing/Makefile" ;;
@@ -26229,11 +26156,6 @@
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
@@ -1033,18 +1033,18 @@
sed "$ac_vpsub
diff -ruN hal-0.5.6-old/configure.in hal-0.5.6/configure.in
--- hal-0.5.6-old/configure.in 2006-01-17 01:25:32.000000000 +0100
-+++ hal-0.5.6/configure.in 2006-01-20 11:27:46.000000000 +0100
-@@ -486,6 +486,7 @@
- hald/linux2/addons/Makefile
- hald/solaris/Makefile
- hald/haldaemon
++++ hal-0.5.6/configure.in 2006-02-01 22:40:06.000000000 +0100
+@@ -480,6 +480,7 @@
+ hal.conf
+ Makefile
+ hald/Makefile
+hald-runner/Makefile
- libhal/Makefile
- libhal-storage/Makefile
- tools/Makefile
+ hald/dummy/Makefile
+ hald/linux2/Makefile
+ hald/linux2/probing/Makefile
diff -ruN hal-0.5.6-old/hald/Makefile.am hal-0.5.6/hald/Makefile.am
--- hal-0.5.6-old/hald/Makefile.am 2005-12-08 19:23:23.000000000 +0100
-+++ hal-0.5.6/hald/Makefile.am 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald/Makefile.am 2006-02-01 22:35:10.000000000 +0100
@@ -40,6 +40,7 @@
hald_SOURCES = \
hald_marshal.h hald_marshal.c \
@@ -1055,7 +1055,7 @@
device_store.h device_store.c \
diff -ruN hal-0.5.6-old/hald/Makefile.in hal-0.5.6/hald/Makefile.in
--- hal-0.5.6-old/hald/Makefile.in 2006-01-17 02:07:48.000000000 +0100
-+++ hal-0.5.6/hald/Makefile.in 2006-01-20 11:28:31.000000000 +0100
++++ hal-0.5.6/hald/Makefile.in 2006-02-01 22:49:53.000000000 +0100
@@ -53,9 +53,9 @@
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(sbin_PROGRAMS)
@@ -1087,7 +1087,14 @@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/util.Po at am__quote@
diff -ruN hal-0.5.6-old/hald/hald.c hal-0.5.6/hald/hald.c
--- hal-0.5.6-old/hald/hald.c 2006-01-13 03:24:10.000000000 +0100
-+++ hal-0.5.6/hald/hald.c 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald/hald.c 2006-02-01 22:35:10.000000000 +0100
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+- * CVSID: $Id: hald.c,v 1.45 2006/01/12 17:48:44 dkukawka Exp $
++ * CVSID: $Id: hald.c,v 1.47 2006/01/21 16:54:04 david Exp $
+ *
+ * hald.c : main startup for HAL daemon
+ *
@@ -55,6 +55,7 @@
#include "osspec.h"
#include "hald_dbus.h"
@@ -1163,27 +1170,16 @@
}
/*hal_device_print (device);*/
-@@ -207,7 +172,7 @@
- static void
- usage ()
- {
-- fprintf (stderr, "\n" "usage : hald [--daemon=yes|no] [--verbose=yes|no] [--help]\n");
-+ fprintf (stderr, "\n" "usage : hald [--daemon=yes|no] [--verbose=yes|no] [--help] [--with-runner=location]\n");
- fprintf (stderr,
- "\n"
- " --daemon=yes|no Become a daemon\n"
-@@ -215,8 +180,8 @@
+@@ -215,8 +180,6 @@
" --use-syslog Print out debug messages to syslog instead of stderr.\n"
" Use this option to get debug messages if HAL runs as\n"
" daemon.\n"
- " --retain-privileges Run as root instead of normal user (calling of\n"
- " external scripts to modify fstab etc. will work)\n"
-+ " --with-runner Use the program at the specified location as the\n"
-+ "helper.\n"
" --help Show this information and exit\n"
" --version Output version information and exit"
"\n"
-@@ -261,7 +226,6 @@
+@@ -261,7 +224,6 @@
GError *err = NULL;
gchar data[1];
gsize bytes_read;
@@ -1191,7 +1187,7 @@
/* Empty the pipe */
if (G_IO_STATUS_NORMAL !=
-@@ -273,8 +237,7 @@
+@@ -273,8 +235,7 @@
}
HAL_INFO (("Caught SIGTERM, initiating shutdown"));
@@ -1201,46 +1197,43 @@
exit (0);
out:
-@@ -404,12 +367,9 @@
+@@ -404,13 +365,9 @@
{
GMainLoop *loop;
guint sigterm_iochn_listener_source_id;
- gboolean retain_privs;
char *path;
char newpath[512];
--
+
- retain_privs = FALSE;
-
-+ char *runner_location = NULL;
-
+-
openlog ("hald", LOG_PID, LOG_DAEMON);
-@@ -443,7 +403,7 @@
+ g_type_init ();
+@@ -443,7 +400,6 @@
{"verbose", 1, NULL, 0},
{"use-syslog", 0, NULL, 0},
{"help", 0, NULL, 0},
- {"retain-privileges", 0, NULL, 0},
-+ {"with-runner", 1, NULL, 0},
{"version", 0, NULL, 0},
{NULL, 0, NULL, 0}
};
-@@ -481,8 +441,8 @@
+@@ -481,8 +437,6 @@
usage ();
return 1;
}
- } else if (strcmp (opt, "retain-privileges") == 0) {
- retain_privs = TRUE;
-+ } else if (strcmp (opt, "with-runner") == 0) {
-+ runner_location = strdup(optarg);
} else if (strcmp (opt, "use-syslog") == 0) {
hald_use_syslog = TRUE;
}
-@@ -606,13 +566,16 @@
+@@ -606,13 +560,16 @@
/* set up the local dbus server */
if (!hald_dbus_local_server_init ())
return 1;
+ /* Start the runner helper daemon */
-+ if (!hald_runner_start_runner(runner_location)) {
++ if (!hald_runner_start_runner ()) {
+ return 1;
+ }
+
@@ -1255,7 +1248,7 @@
hald_is_initialising = TRUE;
/* detect devices */
-@@ -659,7 +622,7 @@
+@@ -659,7 +616,7 @@
HAL_INFO (("Device probing completed"));
if (!hald_dbus_init ()) {
@@ -1266,7 +1259,14 @@
diff -ruN hal-0.5.6-old/hald/hald_dbus.c hal-0.5.6/hald/hald_dbus.c
--- hal-0.5.6-old/hald/hald_dbus.c 2006-01-13 03:24:10.000000000 +0100
-+++ hal-0.5.6/hald/hald_dbus.c 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald/hald_dbus.c 2006-02-01 22:35:10.000000000 +0100
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+- * CVSID: $Id: hald_dbus.c,v 1.48 2006/01/12 17:48:44 dkukawka Exp $
++ * CVSID: $Id: hald_dbus.c,v 1.53 2006/01/21 16:54:04 david Exp $
+ *
+ * dbus.c : D-BUS interface of HAL daemon
+ *
@@ -46,6 +46,7 @@
#include "logger.h"
#include "osspec.h"
@@ -1275,7 +1275,44 @@
static DBusConnection *dbus_connection = NULL;
-@@ -2482,55 +2483,35 @@
+@@ -1540,7 +1541,7 @@
+ {
+ dbus_bool_t rc;
+ const char *udi;
+- const char *caps;
++ GSList *caps;
+ char *capability;
+ HalDevice *d;
+ DBusMessage *reply;
+@@ -1573,23 +1574,18 @@
+ DIE (("No memory"));
+
+ rc = FALSE;
+- caps = hal_device_property_get_string (d, "info.capabilities");
++ caps = hal_device_property_get_strlist (d, "info.capabilities");
+ if (caps != NULL) {
+- char **capsv, **iter;
++ GSList *iter;
+
+- capsv = g_strsplit (caps, " ", 0);
+- for (iter = capsv; *iter != NULL; iter++) {
+- if (strcmp (*iter, capability) == 0) {
++ for (iter = caps; iter != NULL; iter=g_slist_next(iter)) {
++ if (strcmp (iter->data, capability) == 0) {
+ rc = TRUE;
+ break;
+ }
+ }
+-
+- g_strfreev (capsv);
+ }
+
+- dbus_free (capability);
+-
+ dbus_message_iter_init_append (reply, &iter);
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &rc);
+
+@@ -2482,54 +2478,36 @@
}
static void
@@ -1294,22 +1331,15 @@
- char buf[512]; /* TODO: don't hardcode error message size */
- char *exp_name;
- char *exp_detail;
--
++ gchar *exp_name = NULL;
++ gchar *exp_detail = NULL;
+
message = (DBusMessage *) data1;
- stderr_fd = (int *) data2;
-+ gchar *exp_name = NULL;
-+ gchar *exp_detail = NULL;
-
+-
- exp_name = NULL;
- exp_detail = NULL;
-+ if (exit_type == HALD_RUN_SUCCESS && error != NULL) {
-+ exp_name = error[0];
-+ if (error[0] != NULL) {
-+ exp_detail = error[1];
-+ }
-+ HAL_INFO (("failed with '%s' '%s'", exp_name, exp_detail));
-+ }
-
+-
- /* read back possible error conditions from stderr */
- if (stderr_fd != NULL) {
- ssize_t num_read;
@@ -1332,35 +1362,40 @@
- exp_detail = g_strndup (p, s - p);
- }
- }
-+ if (exit_type != HALD_RUN_SUCCESS) {
-+ reply = dbus_message_new_error (message, "org.freedesktop.Hal.Device.UnknownError", "An unknown error occured");
-+ if (dbus_connection != NULL) {
-+ if (!dbus_connection_send (dbus_connection, reply, NULL))
-+ DIE (("No memory"));
++
++ if (exit_type == HALD_RUN_SUCCESS && error != NULL &&
++ error[0] != NULL && error[1] != NULL) {
++ exp_name = error[0];
++ if (error[0] != NULL) {
++ exp_detail = error[1];
}
- }
-
- if (exp_name != NULL && exp_detail != NULL) {
-- HAL_INFO (("failed with '%s' '%s'", exp_name, exp_detail));
+ HAL_INFO (("failed with '%s' '%s'", exp_name, exp_detail));
-
- /* throw exception */
-
-- reply = dbus_message_new_error (message, exp_name, exp_detail);
++ }
++
++ if (exit_type != HALD_RUN_SUCCESS) {
++ reply = dbus_message_new_error (message, "org.freedesktop.Hal.Device.UnknownError", "An unknown error occured");
++ if (dbus_connection != NULL) {
++ if (!dbus_connection_send (dbus_connection, reply, NULL))
++ DIE (("No memory"));
++ }
+ dbus_message_unref (reply);
-+ } else if (exp_name != NULL && exp_detail != NULL) {
-+ reply = dbus_message_new_error (message, exp_name, exp_detail);
++ } else if (exp_name != NULL && exp_detail != NULL) {
+ reply = dbus_message_new_error (message, exp_name, exp_detail);
if (reply == NULL) {
/* error name may be invalid - assume caller fucked up and use a generic HAL error name */
- reply = dbus_message_new_error (message, "org.freedesktop.Hal.Device.UnknownError", "An unknown error occured");
-@@ -2562,22 +2543,17 @@
- dbus_message_unref (reply);
+@@ -2563,21 +2541,14 @@
}
-- dbus_message_unref (message);
+ dbus_message_unref (message);
- g_free (stderr_fd);
- g_free (exp_name);
- g_free (exp_detail);
-+ dbus_message_unref (message);
+- g_free (exp_name);
+- g_free (exp_detail);
}
static DBusHandlerResult
@@ -1376,7 +1411,7 @@
const char *sender;
char *extra_env[2];
char uid_export[128];
-@@ -2700,21 +2676,15 @@
+@@ -2700,21 +2671,15 @@
dbus_message_iter_next (&iter);
}
@@ -1407,7 +1442,14 @@
diff -ruN hal-0.5.6-old/hald/hald_dbus.h hal-0.5.6/hald/hald_dbus.h
--- hal-0.5.6-old/hald/hald_dbus.h 2005-11-02 16:38:13.000000000 +0100
-+++ hal-0.5.6/hald/hald_dbus.h 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald/hald_dbus.h 2006-02-01 22:35:10.000000000 +0100
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+- * CVSID: $Id: hald_dbus.h,v 1.10 2005/11/02 15:38:13 david Exp $
++ * CVSID: $Id: hald_dbus.h,v 1.11 2006/01/21 02:45:27 david Exp $
+ *
+ * hal_dbus.h : D-BUS interface of HAL daemon
+ *
@@ -94,6 +94,4 @@
DBusHandlerResult hald_dbus_filter_function (DBusConnection * connection, DBusMessage * message, void *user_data);
@@ -1417,10 +1459,10 @@
#endif /* HAL_DBUS_H */
diff -ruN hal-0.5.6-old/hald/hald_runner.c hal-0.5.6/hald/hald_runner.c
--- hal-0.5.6-old/hald/hald_runner.c 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald/hald_runner.c 2006-01-20 11:27:46.000000000 +0100
-@@ -0,0 +1,419 @@
++++ hal-0.5.6/hald/hald_runner.c 2006-02-01 22:52:24.000000000 +0100
+@@ -0,0 +1,430 @@
+/***************************************************************************
-+ * CVSID: $Id$
++ * CVSID: $Id: hald_runner.c,v 1.5 2006/01/21 19:08:27 david Exp $
+ *
+ * hald_runner.c - Interface to the hal runner helper daemon
+ *
@@ -1480,7 +1522,7 @@
+ runner_connection = new_connection;
+ dbus_connection_ref (new_connection);
+ dbus_connection_setup_with_g_main (new_connection, NULL);
-+ dbus_server_unref(server);
++ /* dbus_server_unref(server); */
+ }
+}
+
@@ -1491,13 +1533,15 @@
+}
+
+gboolean
-+hald_runner_start_runner(gchar *runner_location) {
++hald_runner_start_runner(void)
++{
+ DBusServer *server = NULL;
+ DBusError err;
+ GError *error = NULL;
+ GPid pid;
+ char *argv[] = { NULL, NULL};
-+ char *env[] = { NULL, NULL};
++ char *env[] = { NULL, NULL, NULL, NULL};
++ const char *hald_runner_path;
+
+ dbus_error_init(&err);
+ server = dbus_server_listen(DBUS_SERVER_ADDRESS, &err);
@@ -1509,22 +1553,30 @@
+ dbus_server_setup_with_g_main(server, NULL);
+ dbus_server_set_new_connection_function(server, handle_connection,
+ NULL, NULL);
-+ if (runner_location == NULL) {
-+ runner_location = g_strdup_printf("%s/hald-runner", PACKAGE_LIBEXEC_DIR);
++ argv[0] = "hald-runner";
++ env[0] = g_strdup_printf("HALD_RUNNER_DBUS_ADDRESS=%s",
++ dbus_server_get_address(server));
++ hald_runner_path = g_getenv("HALD_RUNNER_PATH");
++ if (hald_runner_path != NULL) {
++ env[1] = g_strdup_printf ("PATH=%s:" PACKAGE_LIBEXEC_DIR ":" PACKAGE_SCRIPT_DIR, hald_runner_path);
+ } else {
-+ runner_location = g_strdup(runner_location);
++ env[1] = g_strdup_printf ("PATH=" PACKAGE_LIBEXEC_DIR ":" PACKAGE_SCRIPT_DIR);
+ }
-+ argv[0] = runner_location;
-+ env[0] = g_strdup_printf("HALD_RUNNER_DBUS_ADDRESS=%s",
-+ dbus_server_get_address(server));
+
-+ if (!g_spawn_async("/", argv, env, G_SPAWN_DO_NOT_REAP_CHILD,
++ /*env[2] = "DBUS_VERBOSE=1";*/
++
++
++ if (!g_spawn_async(NULL, argv, env, G_SPAWN_DO_NOT_REAP_CHILD|G_SPAWN_SEARCH_PATH,
+ NULL, NULL, &pid, &error)) {
++ HAL_ERROR (("Could not spawn runner : '%s'", error->message));
++ g_error_free (error);
+ goto error;
+ }
-+ g_free(argv[0]);
+ g_free(env[0]);
++ g_free(env[1]);
+
++ HAL_INFO (("Runner has pid %d", pid));
++
+ g_child_watch_add(pid, runner_died, NULL);
+ while (runner_connection == NULL) {
+ /* Wait for the runner */
@@ -1560,7 +1612,7 @@
+ env = g_strdup_printf ("HAL_PROP_%s=%s", prop_upper, value);
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &env);
+
-+ g_free(env);
++ g_free (env);
+ g_free (value);
+ g_free (prop_upper);
+
@@ -1685,7 +1737,8 @@
+}
+
+static void
-+call_notify(DBusPendingCall *pending, void *user_data) {
++call_notify(DBusPendingCall *pending, void *user_data)
++{
+ HelperData *hb = (HelperData *)user_data;
+ dbus_uint32_t exitt = HALD_RUN_SUCCESS;
+ dbus_int32_t return_code = 0;
@@ -1840,11 +1893,11 @@
+}
diff -ruN hal-0.5.6-old/hald/hald_runner.h hal-0.5.6/hald/hald_runner.h
--- hal-0.5.6-old/hald/hald_runner.h 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald/hald_runner.h 2006-01-20 11:27:46.000000000 +0100
-@@ -0,0 +1,75 @@
++++ hal-0.5.6/hald/hald_runner.h 2006-02-01 22:52:24.000000000 +0100
+@@ -0,0 +1,76 @@
+/***************************************************************************
+ *
-+ * CVSID: $Id$
++ * CVSID: $Id: hald_runner.h,v 1.2 2006/01/21 16:54:04 david Exp $
+ *
+ * hald_runner.h - Interface to the hal runner helper daemon
+ *
@@ -1891,7 +1944,7 @@
+
+/* Start the runner daemon */
+gboolean
-+hald_runner_start_runner(gchar *runner_location);
++hald_runner_start_runner(void);
+
+/* Start a helper, returns true on a successfull start */
+gboolean
@@ -1907,7 +1960,8 @@
+ HalRunTerminatedCB cb,
+ gpointer data1, gpointer data2);
+void
-+hald_runner_run_method(HalDevice *device, const gchar *command_line, char **extra_env,
++hald_runner_run_method(HalDevice *device,
++ const gchar *command_line, char **extra_env,
+ gchar *input, gboolean error_on_stderr,
+ guint32 timeout,
+ HalRunTerminatedCB cb,
@@ -1917,10 +1971,34 @@
+void hald_runner_kill_all();
+
+#endif
+diff -ruN hal-0.5.6-old/hald/haldaemon.in hal-0.5.6/hald/haldaemon.in
+--- hal-0.5.6-old/hald/haldaemon.in 2005-02-25 02:55:08.000000000 +0100
++++ hal-0.5.6/hald/haldaemon.in 2006-02-01 22:35:10.000000000 +0100
+@@ -25,7 +25,7 @@
+
+ start() {
+ echo -n $"Starting HAL daemon: "
+- daemon --check $servicename $processname --retain-privileges
++ daemon --check $servicename $processname
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch @LOCALSTATEDIR@/lock/subsys/$servicename
diff -ruN hal-0.5.6-old/hald/linux2/blockdev.c hal-0.5.6/hald/linux2/blockdev.c
--- hal-0.5.6-old/hald/linux2/blockdev.c 2006-01-08 18:58:02.000000000 +0100
-+++ hal-0.5.6/hald/linux2/blockdev.c 2006-01-20 11:27:46.000000000 +0100
-@@ -60,6 +60,7 @@
++++ hal-0.5.6/hald/linux2/blockdev.c 2006-02-01 23:00:20.000000000 +0100
+@@ -1,9 +1,10 @@
+ /***************************************************************************
+- * CVSID: $Id: blockdev.c,v 1.29 2006/01/06 18:41:23 dkukawka Exp $
++ * CVSID: $Id: blockdev.c,v 1.33 2006/01/23 12:15:50 kay Exp $
+ *
+ * blockdev.c : Handling of block devices
+ *
+ * Copyright (C) 2005 David Zeuthen, <david at fubar.dk>
++ * Copyright (C) 2005,2006 Kay Sievers, <kay.sievers at vrfy.org>
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+@@ -60,6 +61,7 @@
#include "../device_info.h"
#include "../hald_dbus.h"
#include "../util.h"
@@ -1928,7 +2006,7 @@
#include "osspec_linux.h"
-@@ -269,15 +270,16 @@
+@@ -269,15 +271,16 @@
}
static void
@@ -1948,17 +2026,42 @@
if (d == NULL) {
HAL_INFO (("Device object already removed"));
-@@ -291,7 +293,8 @@
+@@ -291,7 +294,8 @@
*
* (return code 2 means fs found on main block device (for non-volumes))
*/
- if (timed_out || !(return_code == 0 || (!is_volume && return_code == 2))) {
+ if (exit_type != HALD_RUN_SUCCESS
-+ || !(return_code == 0 || (!is_volume && return_code == 2))) {
++ || !(return_code == 0 || (!is_volume && return_code == 2))) {
hal_device_store_remove (hald_get_tdl (), d);
g_object_unref (d);
hotplug_event_end (end_token);
-@@ -369,15 +372,12 @@
+@@ -332,7 +336,7 @@
+
+
+ out:
+- ;
++ return;
+ }
+
+ static void
+@@ -350,7 +354,7 @@
+ hal_device_property_set_string (d, "info.product", "Ignored Device");
+
+ HAL_INFO (("Preprobing merged info.ignore==TRUE"));
+-
++
+ /* Move from temporary to global device store */
+ hal_device_store_remove (hald_get_tdl (), d);
+ hal_device_store_add (hald_get_gdl (), d);
+@@ -362,22 +366,18 @@
+ if (!hal_device_property_get_bool (d, "storage.media_check_enabled") &&
+ hal_device_property_get_bool (d, "storage.no_partitions_hint")) {
+
+-
+ /* special probe for PC floppy drives */
+ if (strcmp (hal_device_property_get_string (d, "storage.bus"), "platform") == 0 &&
+ strcmp (hal_device_property_get_string (d, "storage.drive_type"), "floppy") == 0) {
HAL_INFO (("Probing PC floppy %s to see if it is present",
hal_device_property_get_string (d, "block.device")));
@@ -1979,7 +2082,7 @@
} else {
HAL_INFO (("Not probing storage device %s",
hal_device_property_get_string (d, "block.device")));
-@@ -397,14 +397,12 @@
+@@ -397,25 +397,23 @@
HAL_INFO (("Probing storage device %s", hal_device_property_get_string (d, "block.device")));
/* probe the device */
@@ -1990,17 +2093,42 @@
- g_object_unref (d);
- hotplug_event_end (end_token);
- }
--
-+ hald_runner_run(d,
-+ "hald-probe-storage", NULL,
-+ HAL_HELPER_TIMEOUT,
-+ add_blockdev_probing_helper_done,
-+ (gpointer) end_token, NULL);
-+
++ hald_runner_run(d,
++ "hald-probe-storage", NULL,
++ HAL_HELPER_TIMEOUT,
++ add_blockdev_probing_helper_done,
++ (gpointer) end_token, NULL);
+
out:
- ;
+- ;
++ return;
}
-@@ -434,14 +432,11 @@
+
+-static void
++static void
+ blockdev_callouts_preprobing_volume_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
+ {
+ void *end_token = (void *) userdata1;
+
+ if (hal_device_property_get_bool (d, "info.ignore")) {
+- /* Leave the device here with info.ignore==TRUE so we won't pick up children
++ /* Leave the device here with info.ignore==TRUE so we won't pick up children
+ * Also remove category and all capabilities
+ */
+ hal_device_property_remove (d, "info.category");
+@@ -424,26 +422,23 @@
+ hal_device_property_set_string (d, "info.product", "Ignored Device");
+
+ HAL_INFO (("Preprobing merged info.ignore==TRUE"));
+-
++
+ /* Move from temporary to global device store */
+ hal_device_store_remove (hald_get_tdl (), d);
+ hal_device_store_add (hald_get_gdl (), d);
+-
++
+ hotplug_event_end (end_token);
+ goto out;
}
/* probe the device */
@@ -2013,14 +2141,47 @@
- }
-
+ hald_runner_run (d,
-+ "hald-probe-volume", NULL,
-+ HAL_HELPER_TIMEOUT,
-+ add_blockdev_probing_helper_done,
-+ (gpointer) end_token, NULL);
++ "hald-probe-volume", NULL,
++ HAL_HELPER_TIMEOUT,
++ add_blockdev_probing_helper_done,
++ (gpointer) end_token, NULL);
out:
- ;
+- ;
++ return;
}
-@@ -1162,14 +1157,15 @@
+
+ static const gchar *
+@@ -535,6 +530,7 @@
+ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_file, gboolean is_partition,
+ HalDevice *parent, void *end_token)
+ {
++ HotplugEvent *hotplug_event = (HotplugEvent *) end_token;
+ gchar *major_minor;
+ HalDevice *d;
+ unsigned int major, minor;
+@@ -659,7 +655,7 @@
+
+ scsidev = NULL;
+ physdev = NULL;
+- physdev_udi = NULL;
++ physdev_udi = NULL;
+
+ is_removable = FALSE;
+ is_hotpluggable = FALSE;
+@@ -883,10 +879,10 @@
+ * VOLUMES
+ *
+ ************************/
+-
+ hal_device_property_set_string (d, "block.storage_device", parent->udi);
+
+- /* set defaults */
++ /* defaults */
++ hal_device_property_set_string (d, "storage.model", "");
+ hal_device_property_set_string (d, "volume.fstype", "");
+ hal_device_property_set_string (d, "volume.fsusage", "");
+ hal_device_property_set_string (d, "volume.fsversion", "");
+@@ -1162,14 +1158,15 @@
}
static void
@@ -2039,7 +2200,7 @@
if (d == NULL) {
HAL_INFO (("Device object already removed"));
-@@ -1220,13 +1216,11 @@
+@@ -1220,13 +1217,11 @@
}
/* now see if we got a file system on the main block device */
@@ -2060,7 +2221,14 @@
out:
diff -ruN hal-0.5.6-old/hald/linux2/classdev.c hal-0.5.6/hald/linux2/classdev.c
--- hal-0.5.6-old/hald/linux2/classdev.c 2006-01-17 01:25:34.000000000 +0100
-+++ hal-0.5.6/hald/linux2/classdev.c 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald/linux2/classdev.c 2006-02-01 22:35:10.000000000 +0100
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+- * CVSID: $Id: classdev.c,v 1.40 2006/01/13 16:40:31 kay Exp $
++ * CVSID: $Id: classdev.c,v 1.42 2006/01/28 22:51:18 david Exp $
+ *
+ * classdev.c : Handling of functional kernel devices
+ *
@@ -65,6 +65,7 @@
#include "../device_info.h"
#include "../device_store.h"
@@ -2125,7 +2293,7 @@
void
diff -ruN hal-0.5.6-old/hald/linux2/osspec.c hal-0.5.6/hald/linux2/osspec.c
--- hal-0.5.6-old/hald/linux2/osspec.c 2006-01-13 03:24:10.000000000 +0100
-+++ hal-0.5.6/hald/linux2/osspec.c 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald/linux2/osspec.c 2006-02-01 22:56:32.000000000 +0100
@@ -66,6 +66,7 @@
#include "../logger.h"
#include "../hald.h"
@@ -2134,7 +2302,20 @@
#include "../device_info.h"
#include "../util.h"
-@@ -457,8 +458,9 @@
+@@ -75,12 +76,10 @@
+ #include "hotplug_helper.h"
+
+ #include "ids.h"
+-
+ #include "acpi.h"
+ #include "apm.h"
+ #include "pmu.h"
+ #include "blockdev.h"
+-
+ #include "osspec_linux.h"
+
+ static char *hal_sysfs_path;
+@@ -457,8 +456,9 @@
}
static void
@@ -2146,7 +2327,7 @@
{
const char *chassis_type;
const char *system_manufacturer;
-@@ -635,16 +637,15 @@
+@@ -635,16 +635,15 @@
/* TODO: add prober for PowerMac's */
if (should_decode_dmi) {
@@ -2173,7 +2354,14 @@
DBusHandlerResult
diff -ruN hal-0.5.6-old/hald/util.c hal-0.5.6/hald/util.c
--- hal-0.5.6-old/hald/util.c 2005-12-08 19:23:23.000000000 +0100
-+++ hal-0.5.6/hald/util.c 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald/util.c 2006-02-01 22:35:10.000000000 +0100
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+- * CVSID: $Id: util.c,v 1.34 2005/11/29 17:38:00 dkukawka Exp $
++ * CVSID: $Id: util.c,v 1.36 2006/01/23 12:15:50 kay Exp $
+ *
+ * util.c - Various utilities
+ *
@@ -50,6 +50,7 @@
#include "hald_dbus.h"
@@ -2455,7 +2643,7 @@
c->next_program++;
}
}
-@@ -1250,29 +1012,6 @@
+@@ -1250,27 +1012,21 @@
;
}
@@ -2465,30 +2653,57 @@
- */
-unsigned int
-hal_util_kill_all_helpers (void)
--{
++gchar *
++hal_util_strdup_valid_utf8 (const char *str)
+ {
- unsigned int n;
- GSList *i;
--
++ char *endchar;
++ char *newstr;
+
- n = 0;
- for (i = running_helpers; i != NULL; i = i->next) {
- HalHelperData *ed;
--
++ if (str == NULL)
++ return NULL;
+
- ed = i->data;
- HAL_INFO (("Killing helper with pid %d", ed->pid));
- kill (ed->pid, SIGTERM);
- n++;
- }
--
++ newstr = g_strdup (str);
+
- return n;
--}
--
++ while (!g_utf8_validate (str, -1, (const char **) &endchar)) {
++ *endchar = '?';
++ }
++ return newstr;
+ }
+
void
- hal_util_hexdump (const void *mem, unsigned int size)
- {
diff -ruN hal-0.5.6-old/hald/util.h hal-0.5.6/hald/util.h
--- hal-0.5.6-old/hald/util.h 2005-11-14 17:16:03.000000000 +0100
-+++ hal-0.5.6/hald/util.h 2006-01-20 11:27:46.000000000 +0100
-@@ -81,38 +81,6 @@
++++ hal-0.5.6/hald/util.h 2006-02-01 22:35:10.000000000 +0100
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+- * CVSID: $Id: util.h,v 1.15 2005/11/09 20:45:44 dkukawka Exp $
++ * CVSID: $Id: util.h,v 1.17 2006/01/23 12:15:50 kay Exp $
+ *
+ * util.h - Various utilities
+ *
+@@ -29,6 +29,10 @@
+ #include "device.h"
+ #include "device_store.h"
+
++#define HAL_NAME_MAX 256
++#define HAL_PATH_MAX 256
++#define HAL_HELPER_TIMEOUT 10000
++
+ int util_compute_time_remaining (const char *id, int chargeRate, int chargeLevel, int chargeLastFull,
+ gboolean isDischarging, gboolean isCharging, gboolean guessChargeRate);
+
+@@ -81,38 +85,6 @@
const gchar *linestart, guint elem, const gchar *expected,
gboolean reuse_file);
@@ -2527,9 +2742,31 @@
gchar **hal_util_dup_strv_from_g_slist (GSList *strlist);
typedef void (*HalCalloutsDone) (HalDevice *d, gpointer userdata1, gpointer userdata2);
+@@ -121,10 +93,8 @@
+ void hal_util_callout_device_remove (HalDevice *d, HalCalloutsDone callback, gpointer userdata1, gpointer userdata2);
+ void hal_util_callout_device_preprobe (HalDevice *d, HalCalloutsDone callback, gpointer userdata1, gpointer userdata2);
+
+-void hal_util_hexdump (const void *buf, unsigned int size);
+-
+-#define HAL_HELPER_TIMEOUT 10000
++gchar *hal_util_strdup_valid_utf8 (const char *str);
+
+-#define HAL_PATH_MAX 256
++void hal_util_hexdump (const void *buf, unsigned int size);
+
+ #endif /* UTIL_H */
+diff -ruN hal-0.5.6-old/hald-runner/.cvsignore hal-0.5.6/hald-runner/.cvsignore
+--- hal-0.5.6-old/hald-runner/.cvsignore 1970-01-01 01:00:00.000000000 +0100
++++ hal-0.5.6/hald-runner/.cvsignore 2006-01-21 12:54:46.000000000 +0100
+@@ -0,0 +1,5 @@
++.deps
++.libs
++Makefile
++Makefile.in
++hald-runner
diff -ruN hal-0.5.6-old/hald-runner/Makefile.am hal-0.5.6/hald-runner/Makefile.am
--- hal-0.5.6-old/hald-runner/Makefile.am 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald-runner/Makefile.am 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald-runner/Makefile.am 2006-01-21 03:45:27.000000000 +0100
@@ -0,0 +1,16 @@
+## Process this file with automake to produce Makefile.in
+INCLUDES = \
@@ -2549,7 +2786,7 @@
+hald_runner_LDADD = @PACKAGE_LIBS@ @DBUS_LIBS@
diff -ruN hal-0.5.6-old/hald-runner/Makefile.in hal-0.5.6/hald-runner/Makefile.in
--- hal-0.5.6-old/hald-runner/Makefile.in 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald-runner/Makefile.in 2006-01-20 11:28:30.000000000 +0100
++++ hal-0.5.6/hald-runner/Makefile.in 2006-02-01 22:49:52.000000000 +0100
@@ -0,0 +1,573 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
@@ -3126,10 +3363,10 @@
+.NOEXPORT:
diff -ruN hal-0.5.6-old/hald-runner/main.c hal-0.5.6/hald-runner/main.c
--- hal-0.5.6-old/hald-runner/main.c 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald-runner/main.c 2006-01-20 11:27:46.000000000 +0100
-@@ -0,0 +1,219 @@
++++ hal-0.5.6/hald-runner/main.c 2006-01-30 15:49:59.000000000 +0100
+@@ -0,0 +1,217 @@
+/***************************************************************************
-+ * CVSID: $Id$
++ * CVSID: $Id: main.c,v 1.3 2006/01/23 14:54:48 kay Exp $
+ *
+ * main.c - Main dbus interface of the hald runner
+ *
@@ -3162,197 +3399,195 @@
+#include "runner.h"
+
+static gboolean
-+parse_first_part(run_request *r, DBusMessage *msg, DBusMessageIter *iter) {
-+ DBusMessageIter sub_iter;
-+ char *tmpstr;
++parse_first_part(run_request *r, DBusMessage *msg, DBusMessageIter *iter)
++{
++ DBusMessageIter sub_iter;
++ char *tmpstr;
+
-+ /* First should be the device UDI */
-+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
-+ goto malformed;
-+ dbus_message_iter_get_basic(iter, &tmpstr);
-+ r->udi = g_strdup(tmpstr);
++ /* First should be the device UDI */
++ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
++ goto malformed;
++ dbus_message_iter_get_basic(iter, &tmpstr);
++ r->udi = g_strdup(tmpstr);
+
-+ /* Then the environment array */
-+ if (!dbus_message_iter_next(iter) ||
-+ dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
-+ goto malformed;
-+ dbus_message_iter_recurse(iter, &sub_iter);
-+ r->environment = get_string_array(&sub_iter);
++ /* Then the environment array */
++ if (!dbus_message_iter_next(iter) || dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
++ goto malformed;
++ dbus_message_iter_recurse(iter, &sub_iter);
++ r->environment = get_string_array(&sub_iter);
+
-+ /* Then argv */
-+ if (!dbus_message_iter_next(iter) ||
-+ dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
-+ goto malformed;
-+ dbus_message_iter_recurse(iter, &sub_iter);
-+ r->argv = get_string_array(&sub_iter);
++ /* Then argv */
++ if (!dbus_message_iter_next(iter) || dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
++ goto malformed;
++ dbus_message_iter_recurse(iter, &sub_iter);
++ r->argv = get_string_array(&sub_iter);
+
-+ return TRUE;
++ return TRUE;
+
+malformed:
-+ return FALSE;
++ return FALSE;
+}
+
+static void
-+handle_run(DBusConnection *con, DBusMessage *msg) {
-+ DBusMessage *reply;
-+ DBusMessageIter iter;
-+ run_request *r;
-+ char *tmpstr;
++handle_run(DBusConnection *con, DBusMessage *msg)
++{
++ DBusMessage *reply;
++ DBusMessageIter iter;
++ run_request *r;
++ char *tmpstr;
+
-+ r = new_run_request();
-+ g_assert(dbus_message_iter_init(msg, &iter));
++ r = new_run_request();
++ g_assert(dbus_message_iter_init(msg, &iter));
+
-+ if (!parse_first_part(r, msg, &iter))
-+ goto malformed;
++ if (!parse_first_part(r, msg, &iter))
++ goto malformed;
+
-+ /* Next a string of what should be written to stdin */
-+ if (!dbus_message_iter_next(&iter) ||
-+ dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
-+ goto malformed;
-+ dbus_message_iter_get_basic(&iter, &tmpstr);
-+ r->input = g_strdup(tmpstr);
++ /* Next a string of what should be written to stdin */
++ if (!dbus_message_iter_next(&iter) || dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
++ goto malformed;
++ dbus_message_iter_get_basic(&iter, &tmpstr);
++ r->input = g_strdup(tmpstr);
+
-+ /* Then an bool to indicate if we should grab stderr */
-+ if (!dbus_message_iter_next(&iter) ||
-+ dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_BOOLEAN)
-+ goto malformed;
-+ dbus_message_iter_get_basic(&iter, &(r->error_on_stderr));
++ /* Then an bool to indicate if we should grab stderr */
++ if (!dbus_message_iter_next(&iter) || dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_BOOLEAN)
++ goto malformed;
++ dbus_message_iter_get_basic(&iter, &(r->error_on_stderr));
+
-+ /* Then an uint32 timeout for it */
-+ if (!dbus_message_iter_next(&iter) ||
-+ dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
-+ goto malformed;
-+ dbus_message_iter_get_basic(&iter, &(r->timeout));
++ /* Then an uint32 timeout for it */
++ if (!dbus_message_iter_next(&iter) || dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
++ goto malformed;
++ dbus_message_iter_get_basic(&iter, &(r->timeout));
+
-+ /* let run_request_run handle the reply */
-+ run_request_run(r, con, msg);
-+ return ;
++ /* let run_request_run handle the reply */
++ run_request_run(r, con, msg);
++ return;
++
+malformed:
-+ del_run_request(r);
-+ reply = dbus_message_new_error(msg, "org.freedesktop.HalRunner.Malformed",
-+ "Malformed run request");
-+ dbus_connection_send(con, reply, NULL);
-+ dbus_message_unref(reply);
++ del_run_request(r);
++ reply = dbus_message_new_error(msg, "org.freedesktop.HalRunner.Malformed",
++ "Malformed run request");
++ dbus_connection_send(con, reply, NULL);
++ dbus_message_unref(reply);
+}
+
+static void
-+handle_start(DBusConnection *con, DBusMessage *msg) {
-+ DBusMessage *reply;
-+ DBusMessageIter iter;
-+ run_request *r;
++handle_start(DBusConnection *con, DBusMessage *msg)
++{
++ DBusMessage *reply;
++ DBusMessageIter iter;
++ run_request *r;
+
-+ r = new_run_request();
-+ g_assert(dbus_message_iter_init(msg, &iter));
++ r = new_run_request();
++ g_assert(dbus_message_iter_init(msg, &iter));
+
-+ if (!dbus_message_iter_init(msg, &iter) || !parse_first_part(r, msg, &iter))
-+ goto malformed;
++ if (!dbus_message_iter_init(msg, &iter) || !parse_first_part(r, msg, &iter))
++ goto malformed;
+
-+ if (run_request_run(r, NULL, NULL)) {
-+ reply = dbus_message_new_method_return(msg);
-+ } else {
-+ reply = dbus_message_new_error(msg, "org.freedesktop.HalRunner.Failed",
-+ "Start request failed");
-+ }
-+ dbus_connection_send(con, reply, NULL);
-+ dbus_message_unref(reply);
-+ return ;
++ if (run_request_run(r, NULL, NULL)) {
++ reply = dbus_message_new_method_return(msg);
++ } else {
++ reply = dbus_message_new_error(msg, "org.freedesktop.HalRunner.Failed",
++ "Start request failed");
++ }
++ dbus_connection_send(con, reply, NULL);
++ dbus_message_unref(reply);
++ return ;
+malformed:
-+ del_run_request(r);
-+ reply = dbus_message_new_error(msg, "org.freedesktop.HalRunner.Malformed",
-+ "Malformed start request");
-+ dbus_connection_send(con, reply, NULL);
-+ dbus_message_unref(reply);
++ del_run_request(r);
++ reply = dbus_message_new_error(msg, "org.freedesktop.HalRunner.Malformed",
++ "Malformed start request");
++ dbus_connection_send(con, reply, NULL);
++ dbus_message_unref(reply);
+}
+
+static void
-+handle_kill(DBusConnection *con, DBusMessage *msg) {
-+ DBusError error;
-+ DBusMessage *reply = NULL;
-+ char *udi;
++handle_kill(DBusConnection *con, DBusMessage *msg)
++{
++ DBusError error;
++ DBusMessage *reply = NULL;
++ char *udi;
+
-+ dbus_error_init (&error);
-+ if (!dbus_message_get_args(msg, &error,
-+ DBUS_TYPE_STRING, &udi,
-+ DBUS_TYPE_INVALID)) {
-+ reply = dbus_message_new_error (msg,
-+ "org.freedesktop.HalRunner.Malformed",
-+ "Malformed kill message");
-+ g_assert(reply);
-+ dbus_connection_send (con, reply, NULL);
-+ dbus_message_unref(reply);
-+ return;
-+ }
-+ run_kill_udi(udi);
-+ /* always successfull */
-+ reply = dbus_message_new_method_return(msg);
-+ dbus_connection_send(con, reply, NULL);
-+ dbus_message_unref(reply);
++ dbus_error_init (&error);
++ if (!dbus_message_get_args(msg, &error,
++ DBUS_TYPE_STRING, &udi,
++ DBUS_TYPE_INVALID)) {
++ reply = dbus_message_new_error (msg, "org.freedesktop.HalRunner.Malformed",
++ "Malformed kill message");
++ g_assert(reply);
++ dbus_connection_send (con, reply, NULL);
++ dbus_message_unref(reply);
++ return;
++ }
++ run_kill_udi(udi);
++
++ /* always successfull */
++ reply = dbus_message_new_method_return(msg);
++ dbus_connection_send(con, reply, NULL);
++ dbus_message_unref(reply);
+}
+
+static DBusHandlerResult
-+filter(DBusConnection *con, DBusMessage *msg, void *user_data) {
-+ DBusMessage *reply;
++filter(DBusConnection *con, DBusMessage *msg, void *user_data)
++{
++ DBusMessage *reply;
+
-+ if (dbus_message_is_method_call(msg,
-+ "org.freedesktop.HalRunner", "Run")) {
-+ handle_run(con, msg);
-+ return DBUS_HANDLER_RESULT_HANDLED;
-+ } else if (dbus_message_is_method_call(msg,
-+ "org.freedesktop.HalRunner", "Start")) {
-+ handle_start(con, msg);
-+ return DBUS_HANDLER_RESULT_HANDLED;
-+ } else if (dbus_message_is_method_call(msg,
-+ "org.freedesktop.HalRunner", "Kill")) {
-+ handle_kill(con, msg);
-+ return DBUS_HANDLER_RESULT_HANDLED;
-+ } else if (dbus_message_is_method_call(msg,
-+ "org.freedesktop.HalRunner", "KillAll")) {
-+ run_kill_all();
-+ /* alwasy successfull */
-+ reply = dbus_message_new_method_return(msg);
-+ dbus_connection_send(con, reply, NULL);
-+ dbus_message_unref(reply);
-+ return DBUS_HANDLER_RESULT_HANDLED;
-+ }
-+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++ if (dbus_message_is_method_call(msg, "org.freedesktop.HalRunner", "Run")) {
++ handle_run(con, msg);
++ return DBUS_HANDLER_RESULT_HANDLED;
++ } else if (dbus_message_is_method_call(msg, "org.freedesktop.HalRunner", "Start")) {
++ handle_start(con, msg);
++ return DBUS_HANDLER_RESULT_HANDLED;
++ } else if (dbus_message_is_method_call(msg, "org.freedesktop.HalRunner", "Kill")) {
++ handle_kill(con, msg);
++ return DBUS_HANDLER_RESULT_HANDLED;
++ } else if (dbus_message_is_method_call(msg, "org.freedesktop.HalRunner", "KillAll")) {
++ run_kill_all();
++ /* alwasy successfull */
++ reply = dbus_message_new_method_return(msg);
++ dbus_connection_send(con, reply, NULL);
++ dbus_message_unref(reply);
++ return DBUS_HANDLER_RESULT_HANDLED;
++ }
++ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+int
-+main(int argc, char **argv) {
-+ DBusConnection *c;
-+ DBusError error;
-+ GMainLoop *loop;
-+ char *dbus_address;
++main(int argc, char **argv)
++{
++ DBusConnection *c;
++ DBusError error;
++ GMainLoop *loop;
++ char *dbus_address;
+
-+ run_init();
-+ dbus_error_init(&error);
-+ dbus_address = getenv("HALD_RUNNER_DBUS_ADDRESS");
-+ g_assert(dbus_address != NULL);
++ run_init();
++ dbus_error_init(&error);
++ dbus_address = getenv("HALD_RUNNER_DBUS_ADDRESS");
++ g_assert(dbus_address != NULL);
+
-+ c = dbus_connection_open(dbus_address, &error);
-+ if (c == NULL)
-+ goto error;
++ fprintf(stderr, "Runner started - allowed paths are '%s'\n", getenv("PATH"));
+
-+ loop = g_main_loop_new(NULL, FALSE);
++ c = dbus_connection_open(dbus_address, &error);
++ if (c == NULL)
++ goto error;
+
-+ dbus_connection_setup_with_g_main(c, NULL);
-+ dbus_connection_set_exit_on_disconnect(c, TRUE);
-+ dbus_connection_add_filter(c, filter, NULL, NULL);
++ loop = g_main_loop_new(NULL, FALSE);
+
-+ g_main_loop_run(loop);
++ dbus_connection_setup_with_g_main(c, NULL);
++ dbus_connection_set_exit_on_disconnect(c, TRUE);
++ dbus_connection_add_filter(c, filter, NULL, NULL);
+
-+ fprintf(stderr, "Should not be reached\n");
-+
++ g_main_loop_run(loop);
++
+error:
-+ fprintf(stderr,"An error has occured: %s\n", error.message);
-+ return -1;
++ fprintf(stderr,"An error has occured: %s\n", error.message);
++ return -1;
+}
diff -ruN hal-0.5.6-old/hald-runner/runner.c hal-0.5.6/hald-runner/runner.c
--- hal-0.5.6-old/hald-runner/runner.c 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald-runner/runner.c 2006-01-20 11:27:46.000000000 +0100
-@@ -0,0 +1,335 @@
++++ hal-0.5.6/hald-runner/runner.c 2006-01-30 15:49:59.000000000 +0100
+@@ -0,0 +1,347 @@
+/***************************************************************************
-+ * CVSID: $Id$
++ * CVSID: $Id: runner.c,v 1.6 2006/01/29 15:03:27 hughsient Exp $
+ *
+ * runner.c - Process running code
+ *
@@ -3403,295 +3638,307 @@
+GHashTable *udi_hash = NULL;
+
+typedef struct {
-+ run_request *r;
-+ DBusMessage *msg;
-+ DBusConnection *con;
-+ GPid pid;
-+ gint stderr_v;
-+ guint watch;
-+ guint timeout;
-+ gboolean sent_kill;
++ run_request *r;
++ DBusMessage *msg;
++ DBusConnection *con;
++ GPid pid;
++ gint stderr_v;
++ guint watch;
++ guint timeout;
++ gboolean sent_kill;
+} run_data;
+
+static void
-+del_run_data(run_data *rd) {
-+ if (rd == NULL)
-+ return;
++del_run_data(run_data *rd)
++{
++ if (rd == NULL)
++ return;
+
-+ del_run_request(rd->r);
-+ if (rd->msg) {
-+ dbus_message_unref(rd->msg);
-+ }
-+ g_spawn_close_pid(rd->pid);
++ del_run_request(rd->r);
++ if (rd->msg)
++ dbus_message_unref(rd->msg);
+
-+ if (rd->stderr_v >= 0) {
-+ close(rd->stderr_v);
-+ }
++ g_spawn_close_pid(rd->pid);
+
-+ if (rd->timeout != 0) {
-+ g_source_remove(rd->timeout);
-+ }
-+ g_free(rd);
++ if (rd->stderr_v >= 0)
++ close(rd->stderr_v);
++
++ if (rd->timeout != 0)
++ g_source_remove(rd->timeout);
++
++ g_free(rd);
+}
+
+run_request *
-+new_run_request(void) {
-+ run_request *result;
-+ result = g_new0(run_request, 1);
-+ g_assert(result != NULL);
-+ return result;
++new_run_request(void)
++{
++ run_request *result;
++ result = g_new0(run_request, 1);
++ g_assert(result != NULL);
++ return result;
+}
+
+void
-+del_run_request(run_request *r) {
-+ if (r == NULL)
-+ return;
-+ g_free(r->udi);
-+ free_string_array(r->environment);
-+ free_string_array(r->argv);
-+ g_free(r->input);
-+ g_free(r);
++del_run_request(run_request *r)
++{
++ if (r == NULL)
++ return;
++ g_free(r->udi);
++ free_string_array(r->environment);
++ free_string_array(r->argv);
++ g_free(r->input);
++ g_free(r);
+}
+
+static void
-+send_reply(DBusConnection *con, DBusMessage *msg,
-+ guint32 exit_type, gint32 return_code, gchar **error) {
-+ DBusMessage *reply;
-+ DBusMessageIter iter;
-+ int i;
++send_reply(DBusConnection *con, DBusMessage *msg, guint32 exit_type, gint32 return_code, gchar **error)
++{
++ DBusMessage *reply;
++ DBusMessageIter iter;
++ int i;
+
-+ if (con == NULL || msg == NULL)
-+ return;
++ if (con == NULL || msg == NULL)
++ return;
+
-+ reply = dbus_message_new_method_return(msg);
-+ g_assert(reply != NULL);
++ reply = dbus_message_new_method_return(msg);
++ g_assert(reply != NULL);
+
-+ dbus_message_iter_init_append(reply, &iter);
-+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &exit_type);
-+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &return_code);
-+ if (error != NULL) for (i = 0; error[i] != NULL; i++) {
-+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &error[i]);
-+ }
++ dbus_message_iter_init_append(reply, &iter);
++ dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &exit_type);
++ dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &return_code);
++ if (error != NULL) for (i = 0; error[i] != NULL; i++) {
++ dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &error[i]);
++ }
+
-+ dbus_connection_send(con, reply, NULL);
-+ dbus_message_unref(reply);
++ dbus_connection_send(con, reply, NULL);
++ dbus_message_unref(reply);
+}
+
+static void
-+remove_from_hash_table(run_data *rd) {
-+ GList *list;
-+ /* Remove to the hashtable */
-+ list = (GList *)g_hash_table_lookup(udi_hash, rd->r->udi);
-+ list = g_list_remove(list, rd);
-+ /* The hash table will take care to not leak the dupped string */
-+ g_hash_table_insert(udi_hash, g_strdup(rd->r->udi), list);
++remove_from_hash_table(run_data *rd)
++{
++ GList *list;
++
++ /* Remove to the hashtable */
++ list = (GList *)g_hash_table_lookup(udi_hash, rd->r->udi);
++ list = g_list_remove(list, rd);
++ /* The hash table will take care to not leak the dupped string */
++ g_hash_table_insert(udi_hash, g_strdup(rd->r->udi), list);
+}
+
+static void
-+run_exited(GPid pid, gint status, gpointer data) {
-+ run_data *rd = (run_data *)data;
-+ char **error = NULL;
++run_exited(GPid pid, gint status, gpointer data)
++{
++ run_data *rd = (run_data *)data;
++ char **error = NULL;
+
-+ printf("%s exited\n", rd->r->argv[0]);
-+ rd->watch = 0;
-+ if (rd->sent_kill == TRUE) {
-+ /* We send it a kill, so ignore */
-+ del_run_data(rd);
-+ return;
-+ }
-+ /* Check if it was a normal exit */
-+ if (!WIFEXITED(status)) {
-+ /* No not normal termination ? crash ? */
-+ send_reply(rd->con, rd->msg, HALD_RUN_FAILED, 0, NULL);
-+ remove_from_hash_table(rd);
-+ del_run_data(rd);
-+ return;
-+ }
-+ /* normal exit */
-+ if (rd->stderr_v >= 0) {
-+ /* Need to read stderr */
-+ error = get_string_array_from_fd(rd->stderr_v);
-+ rd->stderr_v = -1;
-+ }
-+ if (rd->msg != NULL) {
-+ send_reply(rd->con, rd->msg, HALD_RUN_SUCCESS, WEXITSTATUS(status), error);
-+ }
-+ free_string_array(error);
-+
-+ remove_from_hash_table(rd);
-+ del_run_data(rd);
++ printf("%s exited\n", rd->r->argv[0]);
++ rd->watch = 0;
++ if (rd->sent_kill == TRUE) {
++ /* We send it a kill, so ignore */
++ del_run_data(rd);
++ return;
++ }
++ /* Check if it was a normal exit */
++ if (!WIFEXITED(status)) {
++ /* No not normal termination ? crash ? */
++ send_reply(rd->con, rd->msg, HALD_RUN_FAILED, 0, NULL);
++ remove_from_hash_table(rd);
++ del_run_data(rd);
++ return;
++ }
++ /* normal exit */
++ if (rd->stderr_v >= 0) {
++ /* Need to read stderr */
++ error = get_string_array_from_fd(rd->stderr_v);
++ rd->stderr_v = -1;
++ }
++ if (rd->msg != NULL)
++ send_reply(rd->con, rd->msg, HALD_RUN_SUCCESS, WEXITSTATUS(status), error);
++ free_string_array(error);
++ remove_from_hash_table(rd);
++ del_run_data(rd);
+}
+
+static gboolean
+run_timedout(gpointer data) {
-+ run_data *rd = (run_data *)data;
-+ /* Time is up, kill the process, send reply that it was killed!
-+ * Don't wait for exit, because it could hang in state D
-+ */
-+ kill(rd->pid, SIGTERM);
-+ /* Ensure the timeout is not removed in the delete */
-+ rd->timeout = 0;
-+ /* So the exit watch will know it's killed in case it runs*/
-+ rd->sent_kill = TRUE;
++ run_data *rd = (run_data *)data;
++ /* Time is up, kill the process, send reply that it was killed!
++ * Don't wait for exit, because it could hang in state D
++ */
++ kill(rd->pid, SIGTERM);
++ /* Ensure the timeout is not removed in the delete */
++ rd->timeout = 0;
++ /* So the exit watch will know it's killed in case it runs*/
++ rd->sent_kill = TRUE;
+
-+ send_reply(rd->con, rd->msg, HALD_RUN_TIMEOUT, 0, NULL);
-+ remove_from_hash_table(rd);
-+ return FALSE;
++ send_reply(rd->con, rd->msg, HALD_RUN_TIMEOUT, 0, NULL);
++ remove_from_hash_table(rd);
++ return FALSE;
+}
+
-+static
-+gboolean find_program(char **argv) {
-+ /* Search for the program in the dirs where it's allowed to be */
-+ char *dirs[] = { PACKAGE_LIBEXEC_DIR, PACKAGE_SCRIPT_DIR, NULL };
-+ char *program;
-+ char *path = NULL;
-+ struct stat buf;
-+ int i;
++static gboolean
++find_program(char **argv)
++{
++ /* Search for the program in the dirs where it's allowed to be */
++ char *program;
++ char *path = NULL;
+
-+ if (argv[0] == NULL)
-+ return FALSE;
-+ program = g_path_get_basename(argv[0]);
-+ for (i = 0; dirs[i] != NULL; i++) {
-+ path = g_build_filename(dirs[i], program, NULL);
-+ if (stat(path, &buf) == 0) {
-+ break;
-+ }
-+ g_free(path);
-+ path = NULL;
-+ }
-+ g_free(program);
-+ if (path == NULL)
-+ return FALSE;
-+ else {
-+ /* Replace program in argv[0] with the full path */
-+ g_free(argv[0]);
-+ argv[0] = path;
-+ }
-+ return TRUE;
++ if (argv[0] == NULL)
++ return FALSE;
++
++ program = g_path_get_basename(argv[0]);
++
++ /* first search $PATH to make e.g. run-hald.sh work */
++ path = g_find_program_in_path (program);
++ g_free(program);
++ if (path == NULL)
++ return FALSE;
++ else {
++ /* Replace program in argv[0] with the full path */
++ g_free(argv[0]);
++ argv[0] = path;
++ }
++ return TRUE;
+}
+
-+
+/* Run the given request and reply it's result on msg */
-+gboolean
-+run_request_run(run_request *r, DBusConnection *con, DBusMessage *msg) {
-+ GPid pid;
-+ GError *error = NULL;
-+ gint *stdin_p = NULL;
-+ gint *stderr_p = NULL;
-+ gint stdin_v;
-+ gint stderr_v = -1;
-+ run_data *rd = NULL;
-+ GList *list;
++gboolean
++run_request_run(run_request *r, DBusConnection *con, DBusMessage *msg)
++{
++ GPid pid;
++ GError *error = NULL;
++ gint *stdin_p = NULL;
++ gint *stderr_p = NULL;
++ gint stdin_v;
++ gint stderr_v = -1;
++ run_data *rd = NULL;
++ gboolean program_exists = FALSE;
++ char *program_dir = NULL;
++ GList *list;
+
-+ printf("Run started %s (%d) (%d) \n!", r->argv[0], r->timeout,
-+ r->error_on_stderr);
-+ if (r->input != NULL) {
-+ stdin_p = &stdin_v;
-+ }
-+ if (r->error_on_stderr) {
-+ stderr_p = &stderr_v;
-+ }
++ printf("Run started %s (%d) (%d) \n!", r->argv[0], r->timeout,
++ r->error_on_stderr);
++ if (r->input != NULL) {
++ stdin_p = &stdin_v;
++ }
++ if (r->error_on_stderr) {
++ stderr_p = &stderr_v;
++ }
+
-+ if (!find_program(r->argv) ||
-+ !g_spawn_async_with_pipes("/", r->argv, r->environment,
-+ G_SPAWN_DO_NOT_REAP_CHILD,
-+ NULL, NULL, &pid,
-+ stdin_p, NULL, stderr_p, &error)) {
-+ del_run_request(r);
-+ if (con && msg) {
-+ send_reply(con, msg, HALD_RUN_FAILED, 0, NULL);
-+ }
-+ return FALSE;
-+ }
++ program_exists = find_program(r->argv);
+
-+ if (r->input) {
-+ write(stdin_v, r->input, strlen(r->input));
-+ close(stdin_v);
-+ }
++ if (program_exists)
++ program_dir = g_path_get_dirname (r->argv[0]);
+
-+ rd = g_new0(run_data,1);
-+ g_assert(rd != NULL);
-+ rd->r = r;
-+ rd->msg = msg;
-+ if (msg != NULL) {
-+ dbus_message_ref(msg);
-+ }
-+ rd->con = con;
-+ rd->pid = pid;
-+ rd->stderr_v = stderr_v;
-+ rd->sent_kill = FALSE;
++ if (!program_exists ||
++ !g_spawn_async_with_pipes(program_dir, r->argv, r->environment,
++ G_SPAWN_DO_NOT_REAP_CHILD,
++ NULL, NULL, &pid,
++ stdin_p, NULL, stderr_p, &error)) {
++ g_free (program_dir);
++ del_run_request(r);
++ if (con && msg)
++ send_reply(con, msg, HALD_RUN_FAILED, 0, NULL);
++ return FALSE;
++ }
++ g_free (program_dir);
+
-+ /* Add watch for exit of the program */
-+ rd->watch = g_child_watch_add(pid, run_exited, rd);
-+ /* Add timeout if needed */
-+ if (r->timeout > 0) {
-+ rd->timeout = g_timeout_add(r->timeout, run_timedout, rd);
-+ } else {
-+ rd->timeout = 0;
-+ }
-+ /* Add to the hashtable */
-+ list = (GList *)g_hash_table_lookup(udi_hash, r->udi);
-+ list = g_list_prepend(list, rd);
-+ /* The hash table will take care to not leak the dupped string */
-+ g_hash_table_insert(udi_hash, g_strdup(r->udi), list);
-+ return TRUE;
++ if (r->input) {
++ write(stdin_v, r->input, strlen(r->input));
++ close(stdin_v);
++ }
++
++ rd = g_new0(run_data,1);
++ g_assert(rd != NULL);
++ rd->r = r;
++ rd->msg = msg;
++ if (msg != NULL)
++ dbus_message_ref(msg);
++
++ rd->con = con;
++ rd->pid = pid;
++ rd->stderr_v = stderr_v;
++ rd->sent_kill = FALSE;
++
++ /* Add watch for exit of the program */
++ rd->watch = g_child_watch_add(pid, run_exited, rd);
++
++ /* Add timeout if needed */
++ if (r->timeout > 0)
++ rd->timeout = g_timeout_add(r->timeout, run_timedout, rd);
++ else
++ rd->timeout = 0;
++
++ /* Add to the hashtable */
++ list = (GList *)g_hash_table_lookup(udi_hash, r->udi);
++ list = g_list_prepend(list, rd);
++
++ /* The hash table will take care to not leak the dupped string */
++ g_hash_table_insert(udi_hash, g_strdup(r->udi), list);
++ return TRUE;
+}
+
+static void
-+kill_rd(gpointer data, gpointer user_data) {
-+ run_data *rd = (run_data *)data;
++kill_rd(gpointer data, gpointer user_data)
++{
++ run_data *rd = (run_data *)data;
+
-+ kill(rd->pid, SIGTERM);
-+ printf("Sent kill to %d\n", rd->pid);
-+ if (rd->timeout != 0) {
-+ /* Remove the timeout watch */
-+ g_source_remove(rd->timeout);
-+ rd->timeout = 0;
-+ }
-+ /* So the exit watch will know it's killed in case it runs*/
-+ rd->sent_kill = TRUE;
++ kill(rd->pid, SIGTERM);
++ printf("Sent kill to %d\n", rd->pid);
++ if (rd->timeout != 0) {
++ /* Remove the timeout watch */
++ g_source_remove(rd->timeout);
++ rd->timeout = 0;
++ }
+
-+ if (rd->msg != NULL) {
-+ send_reply(rd->con, rd->msg, HALD_RUN_KILLED, 0, NULL);
-+ }
++ /* So the exit watch will know it's killed in case it runs */
++ rd->sent_kill = TRUE;
++
++ if (rd->msg != NULL)
++ send_reply(rd->con, rd->msg, HALD_RUN_KILLED, 0, NULL);
+}
+
+static void
-+do_kill_udi(gchar *udi) {
-+ GList *list;
-+ list = (GList *)g_hash_table_lookup(udi_hash, udi);
-+ g_list_foreach(list, kill_rd, NULL);
-+ g_list_free(list);
++do_kill_udi(gchar *udi)
++{
++ GList *list;
++ list = (GList *)g_hash_table_lookup(udi_hash, udi);
++ g_list_foreach(list, kill_rd, NULL);
++ g_list_free(list);
+}
+
+/* Kill all running request for a udi */
+void
-+run_kill_udi(gchar *udi) {
-+ do_kill_udi(udi);
-+ g_hash_table_remove(udi_hash, udi);
++run_kill_udi(gchar *udi)
++{
++ do_kill_udi(udi);
++ g_hash_table_remove(udi_hash, udi);
+}
+
+static void
+hash_kill_udi(gpointer key, gpointer value, gpointer user_data) {
-+ do_kill_udi(key);
++ do_kill_udi(key);
+}
+
+/* Kill all running request*/
+void
-+run_kill_all() {
-+ g_hash_table_foreach_remove(udi_hash, hash_kill_udi, NULL);
++run_kill_all()
++{
++ g_hash_table_foreach_remove(udi_hash, hash_kill_udi, NULL);
+}
+
+void
-+run_init() {
-+ udi_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
++run_init()
++{
++ udi_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+}
diff -ruN hal-0.5.6-old/hald-runner/runner.h hal-0.5.6/hald-runner/runner.h
--- hal-0.5.6-old/hald-runner/runner.h 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald-runner/runner.h 2006-01-20 11:27:46.000000000 +0100
-@@ -0,0 +1,56 @@
++++ hal-0.5.6/hald-runner/runner.h 2006-01-30 15:49:59.000000000 +0100
+@@ -0,0 +1,57 @@
+/***************************************************************************
-+ * CVSID: $Id$
++ * CVSID: $Id: runner.h,v 1.2 2006/01/23 14:54:48 kay Exp $
+ *
+ * runner.h - Process running interface
+ *
@@ -3723,12 +3970,12 @@
+#include <glib.h>
+
+typedef struct {
-+ gchar *udi;
-+ gchar **environment;
-+ gchar **argv;
-+ gchar *input;
-+ gboolean error_on_stderr;
-+ guint32 timeout;
++ gchar *udi;
++ gchar **environment;
++ gchar **argv;
++ gchar *input;
++ gboolean error_on_stderr;
++ guint32 timeout;
+} run_request;
+
+run_request *new_run_request(void);
@@ -3745,13 +3992,14 @@
+
+/* initialise the actual runner data */
+void run_init();
++
+#endif /* RUNNER_H */
diff -ruN hal-0.5.6-old/hald-runner/utils.c hal-0.5.6/hald-runner/utils.c
--- hal-0.5.6-old/hald-runner/utils.c 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald-runner/utils.c 2006-01-20 11:27:46.000000000 +0100
-@@ -0,0 +1,86 @@
++++ hal-0.5.6/hald-runner/utils.c 2006-01-30 15:49:59.000000000 +0100
+@@ -0,0 +1,89 @@
+/***************************************************************************
-+ * CVSID: $Id$
++ * CVSID: $Id: utils.c,v 1.2 2006/01/23 14:54:48 kay Exp $
+ *
+ * utils.c - Some utils for the hald runner
+ *
@@ -3783,65 +4031,68 @@
+#include "utils.h"
+
+char **
-+get_string_array(DBusMessageIter *iter) {
-+ GArray *array;
-+ char **result;
-+ array = g_array_new(TRUE, FALSE, sizeof(char *));
++get_string_array(DBusMessageIter *iter)
++{
++ GArray *array;
++ char **result;
++ array = g_array_new(TRUE, FALSE, sizeof(char *));
+
-+ while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRING) {
-+ const char *value;
-+ char *t;
-+ dbus_message_iter_get_basic(iter, &value);
-+ t = g_strdup(value);
-+ g_array_append_vals(array, &t, 1);
-+ dbus_message_iter_next(iter);
-+ }
-+ result = (char **) array->data;
-+ g_array_free(array, FALSE);
-+ return result;
++ while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRING) {
++ const char *value;
++ char *t;
++ dbus_message_iter_get_basic(iter, &value);
++ t = g_strdup(value);
++ g_array_append_vals(array, &t, 1);
++ dbus_message_iter_next(iter);
++ }
++ result = (char **) array->data;
++ g_array_free(array, FALSE);
++ return result;
+}
+
+char **
-+get_string_array_from_fd(int fd) {
-+ GArray *array;
-+ char **result;
-+ GString *str;
-+ gsize pos;
-+ GIOChannel *io;
-+ int i = 0;
++get_string_array_from_fd(int fd)
++{
++ GArray *array;
++ char **result;
++ GString *str;
++ gsize pos;
++ GIOChannel *io;
++ int i = 0;
+
-+ array = g_array_new(TRUE, FALSE, sizeof(char *));
-+ str = g_string_new("");
-+ io = g_io_channel_unix_new(fd);
-+ while (g_io_channel_read_line_string(io, str, &pos, NULL)
-+ == G_IO_STATUS_NORMAL && (i++ < 128)) {
-+ char *t;
-+ /* Remove the terminting char aka \n*/
-+ g_string_erase(str, pos, 1);
-+ t = g_strdup(str->str);
-+ g_array_append_vals(array, &t, 1);
-+ }
-+ g_string_free(str, TRUE);
-+ g_io_channel_unref(io);
-+ result = (char **) array->data;
-+ g_array_free(array, FALSE);
-+ return result;
++ array = g_array_new(TRUE, FALSE, sizeof(char *));
++ str = g_string_new("");
++ io = g_io_channel_unix_new(fd);
++ while (g_io_channel_read_line_string(io, str, &pos, NULL) == G_IO_STATUS_NORMAL && (i++ < 128)) {
++ char *t;
++
++ /* Remove the terminting char aka \n */
++ g_string_erase(str, pos, 1);
++ t = g_strdup(str->str);
++ g_array_append_vals(array, &t, 1);
++ }
++ g_string_free(str, TRUE);
++ g_io_channel_unref(io);
++ result = (char **) array->data;
++ g_array_free(array, FALSE);
++ return result;
+}
+
+void
-+free_string_array(char **array) {
-+ char **p;
-+ for (p = array; p != NULL && *p != NULL; p++) {
-+ g_free(*p);
-+ }
-+ g_free(array);
++free_string_array(char **array)
++{
++ char **p;
++
++ for (p = array; p != NULL && *p != NULL; p++)
++ g_free(*p);
++ g_free(array);
+}
diff -ruN hal-0.5.6-old/hald-runner/utils.h hal-0.5.6/hald-runner/utils.h
--- hal-0.5.6-old/hald-runner/utils.h 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.6/hald-runner/utils.h 2006-01-20 11:27:46.000000000 +0100
++++ hal-0.5.6/hald-runner/utils.h 2006-01-21 03:45:27.000000000 +0100
@@ -0,0 +1,35 @@
+/***************************************************************************
-+ * CVSID: $Id$
++ * CVSID: $Id: utils.h,v 1.1 2006/01/21 02:45:27 david Exp $
+ *
+ * utils.h - Some utils for the hald runner
+ *
More information about the Pkg-utopia-commits
mailing list