1 === modified file 'libgksu/gksu-run-helper.c'
2 --- libgksu/gksu-run-helper.c 2008-06-10 14:14:50 +0000
3 +++ libgksu/gksu-run-helper.c 2008-06-11 12:25:55 +0000
5 dirname, strerror (errno));
8 +void read_gstring_from_stdin(GString *s)
14 + readp = fgets(buffer, sizeof(buffer), stdin);
18 + g_string_append(s, buffer);
19 + } while (sizeof(buffer)-1 == strlen(readp));
24 main (int argc, char **argv)
27 gchar *xauth_token = NULL;
36 xauth_file = g_strdup_printf ("%s/.Xauthority",
39 - fgets (buffer, 255, stdin);
41 + GString *s = g_string_sized_new(255);
42 + read_gstring_from_stdin(s);
44 /* strlen ("gksu-run: ") == 10, see su.c */
45 - xauth_display = g_strdup_printf ("%s", buffer + 10);
47 - bzero (buffer, 255);
48 - fgets (buffer, 255, stdin);
51 - sn_id = g_strdup_printf ("%s", buffer + 10);
52 + xauth_display = g_strdup_printf ("%s", s->str + 10);
54 + s = g_string_truncate(s,0);
55 + read_gstring_from_stdin(s);
57 + sn_id = g_strdup_printf ("%s", s->str + 10);
58 setenv("DESKTOP_STARTUP_ID", sn_id, TRUE);
60 - bzero (buffer, 255);
61 - fgets (buffer, 255, stdin);
63 + s = g_string_truncate(s,0);
64 + read_gstring_from_stdin(s);
66 - xauth_token = g_strdup_printf ("%s", buffer + 10);
67 + xauth_token = g_strdup_printf ("%s", s->str + 10);
69 /* a bit more security is always fine */
72 return_code = system (argv[1]);
74 clean_dir (xauth_dir);
75 + g_string_free(s, TRUE);