summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcsapuntz <csapuntz@openbsd.org>1998-08-07 01:31:46 +0000
committercsapuntz <csapuntz@openbsd.org>1998-08-07 01:31:46 +0000
commit80b68a6749276905bc1a520ef2e80acdfdfeb65a (patch)
tree5252c107f7f1d93ceec2284b2e02fdb9ec0ff1d9
parentSupport PAGER environment vairable in conjuction with the 'M' command. (diff)
downloadwireguard-openbsd-80b68a6749276905bc1a520ef2e80acdfdfeb65a.tar.xz
wireguard-openbsd-80b68a6749276905bc1a520ef2e80acdfdfeb65a.zip
Directories can't be opened for writing these days.
-rw-r--r--sbin/mount_portal/pt_file.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sbin/mount_portal/pt_file.c b/sbin/mount_portal/pt_file.c
index 0b260c7aedb..f0a6932505b 100644
--- a/sbin/mount_portal/pt_file.c
+++ b/sbin/mount_portal/pt_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pt_file.c,v 1.5 1997/06/18 13:26:38 deraadt Exp $ */
+/* $OpenBSD: pt_file.c,v 1.6 1998/08/07 01:31:46 csapuntz Exp $ */
/* $NetBSD: pt_file.c,v 1.7 1995/06/06 19:54:30 mycroft Exp $ */
/*
@@ -81,11 +81,18 @@ portal_file(pcr, key, v, so, fdp)
if (seteuid(pcr->pcr_uid) < 0)
return (errno);
+
+ error = 0;
+
fd = open(pbuf, O_RDWR|O_CREAT, 0666);
- if (fd < 0)
- error = errno;
- else
- error = 0;
+ if (fd < 0) {
+ if (errno == EISDIR) {
+ errno = 0;
+ fd = open(pbuf, O_RDONLY);
+ }
+ if (fd < 0)
+ error = errno;
+ }
if (seteuid((uid_t) 0) < 0) { /* XXX - should reset gidset too */
error = errno;