diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1998-08-07 01:31:47 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1998-08-07 01:31:47 +0000 |
commit | 899998987e9dc3d5120d2798ceb72f0bd15185a2 (patch) | |
tree | 221ad4c7750b8fb809011329ce14beeaab5e4425 /sbin/mount_portal/pt_file.c | |
parent | 0b847ab185714fe9423e9f89094f7394a3dfff3c (diff) |
Directories can't be opened for writing these days.
Diffstat (limited to 'sbin/mount_portal/pt_file.c')
-rw-r--r-- | sbin/mount_portal/pt_file.c | 17 |
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; |