Author: nick Date: 2009-01-31 16:55:04 +0000 (Sat, 31 Jan 2009) New Revision: 29416
Modified: libxfce4ui/trunk/libxfce4ui/xfce-execute.c Log: Use g_listenv and g_getenv here too, to avoid problems with environ on different platforms. Modified: libxfce4ui/trunk/libxfce4ui/xfce-execute.c =================================================================== --- libxfce4ui/trunk/libxfce4ui/xfce-execute.c 2009-01-31 14:00:20 UTC (rev 29415) +++ libxfce4ui/trunk/libxfce4ui/xfce-execute.c 2009-01-31 16:55:04 UTC (rev 29416) @@ -240,15 +240,30 @@ if (screen == NULL) screen = xfce_gdk_screen_get_active (NULL); - /* use environ when envp is null */ + /* setup the child environment, without startup id and display */ if (G_LIKELY (envp == NULL)) - envp = environ; + { + /* use the portable g_listenv, but note that this function only returns the + * variable names, not with values, therefore the call to g_getenv */ + envp = g_listenv (); + cenvp = g_new0 (gchar *, g_strv_length (envp) + 3); + for (n = n_cenvp = 0; envp[n] != NULL; n++) + if (strcmp (envp[n], "DESKTOP_STARTUP_ID") != 0 + && strcmp (envp[n], "DISPLAY") != 0) + cenvp[n_cenvp++] = g_strconcat (envp[n], "=", g_getenv (envp[n]), NULL); - /* setup the child environment, without startup id and display */ - cenvp = g_new0 (gchar *, g_strv_length (envp) + 3); - for (n = n_cenvp = 0; envp[n] != NULL; n++) - if (strncmp (envp[n], "DESKTOP_STARTUP_ID", 18) != 0 && strncmp (envp[n], "DISPLAY", 7) != 0) - cenvp[n_cenvp++] = g_strdup (envp[n]); + /* cleanup */ + g_strfreev (envp); + envp = NULL; + } + else + { + cenvp = g_new0 (gchar *, g_strv_length (envp) + 3); + for (n = n_cenvp = 0; envp[n] != NULL; n++) + if (strncmp (envp[n], "DESKTOP_STARTUP_ID", 18) != 0 + && strncmp (envp[n], "DISPLAY", 7) != 0) + cenvp[n_cenvp++] = g_strdup (envp[n]); + } /* add the real display name */ display_name = gdk_screen_make_display_name (screen); @@ -284,7 +299,6 @@ } } } - #endif /* try to spawn the new process */ _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits