File tree 1 file changed +37
-5
lines changed
usr/src/cmd/gui-install/src
1 file changed +37
-5
lines changed Original file line number Diff line number Diff line change 29
29
30
30
#include <glib/gi18n.h>
31
31
#include <gtk/gtk.h>
32
+ #include <stdlib.h>
33
+ #include <sys/types.h>
34
+ #include <sys/wait.h>
35
+ #include <unistd.h>
32
36
#include "callbacks.h"
33
37
#include "installation-profile.h"
34
38
#include "interface-globals.h"
35
39
#include "window-graphics.h"
36
40
#include "welcome-screen.h"
37
41
#include "help-dialog.h"
38
42
43
+ #define XDG_OPEN "/usr/bin/xdg-open"
44
+
39
45
/*
40
46
* Signal handler connected up by Glade XML signal autoconnect
41
47
* for the release notes button clicked event.
@@ -46,19 +52,45 @@ on_releasenotesbutton_clicked(GtkWidget *widget,
46
52
{
47
53
GError * error = NULL ;
48
54
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
+ }
49
85
50
- result = gtk_show_uri (gtk_widget_get_screen (widget ),
51
- RELEASENOTESURL ,
52
- GDK_CURRENT_TIME ,
53
- & error );
54
86
if (result != TRUE) {
55
87
gui_install_prompt_dialog (
56
88
FALSE,
57
89
FALSE,
58
90
FALSE,
59
91
GTK_MESSAGE_ERROR ,
60
92
_ ("Unable to display release notes" ),
61
- error -> message );
93
+ NULL );
62
94
g_error_free (error );
63
95
}
64
96
return (TRUE);
You can’t perform that action at this time.
0 commit comments