diff options
author | 2009-05-20 20:10:03 +0100 | |
---|---|---|
committer | 2009-05-20 20:10:03 +0100 | |
commit | fdba6ee536422f502e20c52b54641e0277b56ed7 (patch) | |
tree | 9666c995ab2b5aa87a7410604882baf7d1217ee3 | |
parent | bf9ef46fe3662867561b7a37b6c10510a5ab31e5 (diff) |
Sort of fix parseenv - this breaks other things though, so don't merge until I have a fix committed.
-rw-r--r-- | uzbl.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -210,15 +210,14 @@ gchar* parseenv (const char* string) { while (environ[i] != NULL) { gchar** env = g_strsplit (environ[i], "=", 0); - gchar* envname = g_malloc (strlen (env[0]) + 1); + gchar* envname = g_strconcat ("$", env[0], NULL); - strcat (envname, "$"); - strcat (envname, env[0]); - - newstring = str_replace(envname, env[1], newstring); + if (g_strrstr (newstring, envname)) { + newstring = str_replace(envname, env[1], newstring); + } g_free (envname); - //g_strfreev (env); - This still breaks uzbl, but shouldn't. The mystery thickens... + //g_strfreev (env); //- This still breaks uzbl, but shouldn't. The mystery thickens... i ++; } @@ -1790,11 +1789,11 @@ find_xdg_file (int xdg_type, char* filename) { if (! file_exists (temporary_file) && xdg_type != 2) { buf = get_xdg_var (XDG[3 + xdg_type]); temporary_string = (char *) strtok_r (buf, ":", &saveptr); - free(buf); + g_free(buf); while ((temporary_string = (char * ) strtok_r (NULL, ":", &saveptr)) && ! file_exists (temporary_file)) { - strcpy (temporary_file, temporary_string); - strcat (temporary_file, filename); + g_free (temporary_file); + temporary_file = g_strconcat (temporary_string, filename, NULL); } } |