hal: Branch 'master'
Martin Pitt
martin at kemper.freedesktop.org
Thu Sep 17 06:43:14 PDT 2009
hald/hald.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
New commits:
commit b296289566a97fa112c7de2fe09389d690841a6a
Author: Maciej Grela <maciej.grela at gmail.com>
Date: Thu Sep 17 15:42:21 2009 +0200
Remove the 512 byte limit for PATH in hald.c
Do not limit/truncate $PATHs which are longer than 512 bytes.
http://bugs.gentoo.org/show_bug.cgi?id=267928
diff --git a/hald/hald.c b/hald/hald.c
index cc47567..a7f9c3a 100644
--- a/hald/hald.c
+++ b/hald/hald.c
@@ -538,8 +538,6 @@ main (int argc, char *argv[])
{
GMainLoop *loop;
guint sigterm_iochn_listener_source_id;
- char *path;
- char newpath[512];
guint opt_child_timeout;
#ifdef HAVE_POLKIT
PolKitError *p_error;
@@ -574,20 +572,15 @@ main (int argc, char *argv[])
* to include this at the end (since we want to overide in
* run-hald.sh and friends)
*/
- path = getenv ("PATH");
- if (path != NULL) {
- g_strlcpy (newpath, path, sizeof (newpath));
- g_strlcat (newpath, ":", sizeof (newpath));
- } else {
- /* No PATH was set */
- newpath[0] = '\0';
- }
-
- g_strlcat (newpath, PACKAGE_LIBEXEC_DIR, sizeof (newpath));
- g_strlcat (newpath, ":", sizeof (newpath));
- g_strlcat (newpath, PACKAGE_SCRIPT_DIR, sizeof (newpath));
+ GString *path = g_string_new(getenv("PATH"));
+ if ( path->len > 0 ) {
+ g_string_append_c(path, ':');
+ }
+
+ g_string_append_printf(path, "%s:%s", PACKAGE_LIBEXEC_DIR, PACKAGE_SCRIPT_DIR);
- setenv ("PATH", newpath, TRUE);
+ setenv ("PATH", path->str, TRUE);
+ g_string_free(path, TRUE);
/* set the default child timeout to 250 seconds */
opt_child_timeout = 250;
More information about the hal-commit
mailing list