summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/sys_socket.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 9ebffb76bc8..3665003969b 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_socket.c,v 1.12 2008/05/23 15:51:12 thib Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.13 2008/10/02 14:40:22 deraadt Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
@@ -167,9 +167,17 @@ soo_stat(struct file *fp, struct stat *ub, struct proc *p)
bzero((caddr_t)ub, sizeof (*ub));
ub->st_mode = S_IFSOCK;
- return ((*so->so_proto->pr_usrreq)(so, PRU_SENSE,
+ if ((so->so_state & SS_CANTRCVMORE) == 0 ||
+ so->so_rcv.sb_cc != 0)
+ ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH;
+ if ((so->so_state & SS_CANTSENDMORE) == 0)
+ ub->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH;
+ ub->st_uid = so->so_euid;
+ ub->st_gid = so->so_egid;
+ (void) ((*so->so_proto->pr_usrreq)(so, PRU_SENSE,
(struct mbuf *)ub, (struct mbuf *)0,
(struct mbuf *)0, p));
+ return (0);
}
/* ARGSUSED */