summaryrefslogtreecommitdiff
path: root/xserver
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-09-08 19:52:27 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-09-08 19:52:27 +0000
commitaa3daf49ca8bf543b7edf025efac63be296cc896 (patch)
tree9c8005d6093d502b93f736339ed8889088819d2f /xserver
parent69cf3b79ffab537e8e530d6c87e3f1d7ad63c405 (diff)
restore version 1.12 of privsep.c which got accidentally reverted
by my xserver 1.6 merge. noticed by oga@
Diffstat (limited to 'xserver')
-rw-r--r--xserver/os/privsep.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/xserver/os/privsep.c b/xserver/os/privsep.c
index 91c99d44c..89fc4824a 100644
--- a/xserver/os/privsep.c
+++ b/xserver/os/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.13 2009/09/06 19:44:37 matthieu Exp $ */
+/* $OpenBSD: privsep.c,v 1.14 2009/09/08 19:52:26 matthieu Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -298,6 +298,7 @@ priv_init(uid_t uid, gid_t gid)
int
priv_open_device(const char *path)
{
+ struct okdev *dev;
priv_cmd_t cmd;
if (priv_fd != -1) {
@@ -305,8 +306,13 @@ priv_open_device(const char *path)
strlcpy(cmd.arg.open.path, path, MAXPATHLEN);
write(priv_fd, &cmd, sizeof(cmd));
return receive_fd(priv_fd);
- } else
- return open(path, O_RDWR | O_NONBLOCK | O_EXCL);
+ } else if ((dev = open_ok(path)) != NULL) {
+ return open(path, dev->flags);
+ } else {
+ errno = EPERM;
+ return -1;
+ }
+ /* NOTREACHED */
}
/* send signal to parent process */