hal/hald-runner main.c,1.3,1.4 utils.c,1.2,1.3 utils.h,1.1,1.2

David Zeuthen david at kemper.freedesktop.org
Thu Feb 23 20:42:59 PST 2006


Update of /cvs/hal/hal/hald-runner
In directory kemper:/tmp/cvs-serv11836/hald-runner

Modified Files:
	main.c utils.c utils.h 
Log Message:
2006-02-23  David Zeuthen  <davidz at redhat.com>

        Patch from Sjoerd Simons <sjoerd at luon.net>.  It adds a save PATH
        to the enviroment by default (hald should never ever specify need
        to add a path to the enviroment send to the runner, so we're not
        overriding anything...).

        * hald-runner/utils.h:

        * hald-runner/utils.c (get_string_array):

        * hald-runner/main.c (parse_first_part):



Index: main.c
===================================================================
RCS file: /cvs/hal/hal/hald-runner/main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- main.c	23 Jan 2006 14:54:48 -0000	1.3
+++ main.c	24 Feb 2006 04:42:57 -0000	1.4
@@ -47,13 +47,15 @@
 	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);
+	/* Add default path for the programs we start */
+	tmpstr = g_strdup_printf("PATH=/sbin:/usr/sbin:/bin:/usr/bin:%s", getenv("PATH"));
+	r->environment = get_string_array(&sub_iter, tmpstr);
 
 	/* 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);
+	r->argv = get_string_array(&sub_iter, NULL);
 
 	return TRUE;
 

Index: utils.c
===================================================================
RCS file: /cvs/hal/hal/hald-runner/utils.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- utils.c	23 Jan 2006 14:54:48 -0000	1.2
+++ utils.c	24 Feb 2006 04:42:57 -0000	1.3
@@ -31,7 +31,7 @@
 #include "utils.h"
 
 char **
-get_string_array(DBusMessageIter *iter)
+get_string_array(DBusMessageIter *iter, char *extra)
 {
 	GArray *array;
 	char **result;
@@ -45,6 +45,8 @@
 		g_array_append_vals(array, &t, 1);
 		dbus_message_iter_next(iter);
 	}
+	if (extra != NULL) 
+		g_array_append_vals(array, &extra, 1);
 	result = (char **) array->data;
 	g_array_free(array, FALSE);
 	return result;

Index: utils.h
===================================================================
RCS file: /cvs/hal/hal/hald-runner/utils.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- utils.h	21 Jan 2006 02:45:27 -0000	1.1
+++ utils.h	24 Feb 2006 04:42:57 -0000	1.2
@@ -28,7 +28,7 @@
 #define DBUS_API_SUBJECT_TO_CHANGE 
 #include <dbus/dbus-glib-lowlevel.h>
 
-char **get_string_array(DBusMessageIter *iter);
+char **get_string_array(DBusMessageIter *iter, gchar *extra);
 char **get_string_array_from_fd(int fd);
 void free_string_array(char **array);
 




More information about the hal-commit mailing list