File tree Expand file tree Collapse file tree 1 file changed +37
-5
lines changed
usr/src/cmd/gui-install/src Expand file tree Collapse file tree 1 file changed +37
-5
lines changed Original file line number Diff line number Diff line change 2929
3030#include <glib/gi18n.h>
3131#include <gtk/gtk.h>
32+ #include <stdlib.h>
33+ #include <sys/types.h>
34+ #include <sys/wait.h>
35+ #include <unistd.h>
3236#include "callbacks.h"
3337#include "installation-profile.h"
3438#include "interface-globals.h"
3539#include "window-graphics.h"
3640#include "welcome-screen.h"
3741#include "help-dialog.h"
3842
43+ #define XDG_OPEN "/usr/bin/xdg-open"
44+
3945/*
4046 * Signal handler connected up by Glade XML signal autoconnect
4147 * for the release notes button clicked event.
@@ -46,19 +52,45 @@ on_releasenotesbutton_clicked(GtkWidget *widget,
4652{
4753 GError * error = NULL ;
4854 gboolean result ;
55+ uid_t suid ;
56+ int pid ;
57+
58+ result = FALSE;
59+ /* The installer will typically be run as root under sudo,
60+ but we don't want to run browser as root */
61+
62+ suid = geteuid ();
63+ if (suid == 0 ) {
64+ char * sudo_uid ;
65+
66+ sudo_uid = getenv ("SUDO_UID" );
67+ if (sudo_uid )
68+ suid = strtol (sudo_uid , (char * * )NULL , 10 );
69+ }
70+ pid = fork ();
71+ if (pid == 0 ) {
72+ if (suid > 0 && suid != geteuid ())
73+ setuid (suid );
74+
75+ execl (XDG_OPEN , XDG_OPEN , RELEASENOTESURL , (char * )0 );
76+ exit (-1 );
77+ } else if (pid > 0 ) {
78+ int status ;
79+
80+ waitpid (pid , & status , 0 );
81+ if (WIFEXITED (status ) && WEXITSTATUS (status ) == 0 ) {
82+ result = TRUE;
83+ }
84+ }
4985
50- result = gtk_show_uri (gtk_widget_get_screen (widget ),
51- RELEASENOTESURL ,
52- GDK_CURRENT_TIME ,
53- & error );
5486 if (result != TRUE) {
5587 gui_install_prompt_dialog (
5688 FALSE,
5789 FALSE,
5890 FALSE,
5991 GTK_MESSAGE_ERROR ,
6092 _ ("Unable to display release notes" ),
61- error -> message );
93+ NULL );
6294 g_error_free (error );
6395 }
6496 return (TRUE);
You can’t perform that action at this time.
0 commit comments