summaryrefslogtreecommitdiff
path: root/src/tty.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-01-24 12:37:17 -0500
committerKristian Høgsberg <krh@bitplanet.net>2012-01-24 12:41:19 -0500
commitbcecca49b875d96e4e6d007ce09a45b2ea301d9d (patch)
treef5a2c39b9af3f122da881b5bef10c764fecfe2c5 /src/tty.c
parentfc6ccb868fa735ee9c6592806f381aa1262bf0b2 (diff)
Revert "weston: Drop priviledges early, and seteuid when needed"
This reverts commit fc6ccb868fa735ee9c6592806f381aa1262bf0b2. We still need root permissions for drmDrop/SetMaster. Without integration with ConsoleKit or systemd we also don't have access to /dev/dri/cardX in the case where we open a new VT.
Diffstat (limited to 'src/tty.c')
-rw-r--r--src/tty.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/tty.c b/src/tty.c
index e823dcb..249f5bb 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -20,8 +20,6 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define _GNU_SOURCE
-
#include <termios.h>
#include <stdio.h>
#include <stdlib.h>
@@ -130,7 +128,6 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func,
struct wl_event_loop *loop;
struct stat buf;
char filename[16];
- uid_t saved_uid, uid, euid;
tty = malloc(sizeof *tty);
if (tty == NULL)
@@ -139,8 +136,6 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func,
memset(tty, 0, sizeof *tty);
tty->compositor = compositor;
tty->vt_func = vt_func;
- getresuid(&uid, &euid, &saved_uid);
- seteuid(saved_uid);
if (tty_nr > 0) {
snprintf(filename, sizeof filename, "/dev/tty%d", tty_nr);
fprintf(stderr, "compositor: using %s\n", filename);
@@ -157,13 +152,11 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func,
if (tty->fd <= 0) {
fprintf(stderr, "failed to open tty: %m\n");
- seteuid(euid);
return NULL;
}
if (tcgetattr(tty->fd, &tty->terminal_attributes) < 0) {
fprintf(stderr, "could not get terminal attributes: %m\n");
- seteuid(euid);
return NULL;
}
@@ -185,7 +178,6 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func,
ret = ioctl(tty->fd, KDSETMODE, KD_GRAPHICS);
if (ret) {
fprintf(stderr, "failed to set KD_GRAPHICS mode on tty: %m\n");
- seteuid(euid);
return NULL;
}
@@ -195,12 +187,9 @@ tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func,
mode.acqsig = SIGUSR1;
if (ioctl(tty->fd, VT_SETMODE, &mode) < 0) {
fprintf(stderr, "failed to take control of vt handling\n");
- seteuid(euid);
return NULL;
}
- seteuid(euid);
-
tty->vt_source =
wl_event_loop_add_signal(loop, SIGUSR1, vt_handler, tty);