summaryrefslogtreecommitdiff
path: root/xserver/os
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2010-12-22 21:36:06 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2010-12-22 21:36:06 +0000
commitfbced338d7b159c6ce7501ee92770c7239d0cac0 (patch)
tree3df023e0c956da660cf6516a03c995bec3a50d4d /xserver/os
parentea886971f42bb44793b0ed08ee7f21f4ff046d18 (diff)
Bring fix from rev 1.12 back once more. ok oga@.
Diffstat (limited to 'xserver/os')
-rw-r--r--xserver/os/privsep.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xserver/os/privsep.c b/xserver/os/privsep.c
index cdbd8f6cf..1f16a6918 100644
--- a/xserver/os/privsep.c
+++ b/xserver/os/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.15 2010/12/05 15:36:10 matthieu Exp $ */
+/* $OpenBSD: privsep.c,v 1.16 2010/12/22 21:36:05 matthieu Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -299,14 +299,21 @@ int
priv_open_device(const char *path)
{
priv_cmd_t cmd;
+ struct okdev *dev;
if (priv_fd != -1) {
cmd.cmd = PRIV_OPEN_DEVICE;
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;
+ }
+ }
}
/* send signal to parent process */