summaryrefslogtreecommitdiff
path: root/sbin/mount_portal/pt_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/mount_portal/pt_file.c')
-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;