Magellan Linux

Contents of /trunk/xload/patches/xload-1.0.1-setuid.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (show annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years ago) by niro
File size: 1092 byte(s)
-import

1 Index: xload.c
2 ===================================================================
3 RCS file: /cvs/xorg/app/xload/xload.c,v
4 retrieving revision 1.2
5 diff -u -r1.2 xload.c
6 --- xload.c 23 Apr 2004 19:54:57 -0000 1.2
7 +++ xload.c 19 Jun 2006 21:32:20 -0000
8 @@ -34,7 +34,7 @@
9 * xload - display system load average in a window
10 */
11
12 -
13 +#include <errno.h>
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <unistd.h>
17 @@ -162,8 +162,17 @@
18 /* For security reasons, we reset our uid/gid after doing the necessary
19 system initialization and before calling any X routines. */
20 InitLoadPoint();
21 - setgid(getgid()); /* reset gid first while still (maybe) root */
22 - setuid(getuid());
23 + /* reset gid first while still (maybe) root */
24 + if (setgid(getgid()) == -1) {
25 + fprintf(stderr, "%s: setgid failed: %s\n",
26 + ProgramName, strerror(errno));
27 + exit(1);
28 + }
29 + if (setuid(getuid()) == -1) {
30 + fprintf(stderr, "%s: setuid failed: %s\n",
31 + ProgramName, strerror(errno));
32 + exit(1);
33 + }
34
35 XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);
36