summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2006-06-20 19:25:51 +0000
committerMatthieu Herrb <matthieu.herrb@laas.fr>2006-06-20 19:25:51 +0000
commit9710f429583c1a1911faa1f3f0a094f05f91e30f (patch)
treeb691abd440b09ce829dd0cf1e298bf07a752626f
parent06af2bdc1793c5012a5d6760189127866677733d (diff)
Check setuid() return value. Bugzilla #7116.
-rw-r--r--ChangeLog5
-rw-r--r--dga.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 24f1004..47eb069 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-20 Matthieu Herrb <matthieu.herrb@laas.fr>
+
+ * dga.c:
+ Check setuid() return value. Bugzilla #7116.
+
2005-12-20 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
diff --git a/dga.c b/dga.c
index e2a7ce4..7305ecd 100644
--- a/dga.c
+++ b/dga.c
@@ -16,6 +16,7 @@
#include <X11/Xmd.h>
#include <X11/extensions/xf86dga.h>
#include <ctype.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
@@ -141,7 +142,10 @@ main(int argc, char *argv[])
#ifndef __UNIXOS2__
/* Give up root privs */
- setuid(getuid());
+ if (setuid(getuid()) == -1) {
+ fprintf(stderr, "Unable to change uid: %s\n", strerror(errno));
+ exit(2);
+ }
#endif
XF86DGASetViewPort(dis, DefaultScreen(dis), 0, 0);