diff options
| author | Chris Costello <chris@FreeBSD.org> | 2000-07-02 23:56:45 +0000 |
|---|---|---|
| committer | Chris Costello <chris@FreeBSD.org> | 2000-07-02 23:56:45 +0000 |
| commit | d41c16130b4cff49821e89bbfa3a7067843bbc6f (patch) | |
| tree | 3583f1eb6df36ec10e4dac67d71d477265b0da66 /sys/kern/sys_socket.c | |
| parent | 0b1c18e4cf719634a63d53f9745e579569e92a75 (diff) | |
Notes
Diffstat (limited to 'sys/kern/sys_socket.c')
| -rw-r--r-- | sys/kern/sys_socket.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 06955bbcb8b6..f58720b7e4a5 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -164,8 +164,17 @@ soo_stat(fp, ub, p) struct socket *so = (struct socket *)fp->f_data; bzero((caddr_t)ub, sizeof (*ub)); - ub->st_mode = S_IFSOCK | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | - S_IROTH | S_IWOTH; + ub->st_mode = S_IFSOCK; + /* + * If SS_CANTRCVMORE is set, but there's still data left in the + * receive buffer, the socket is still readable. + */ + 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_size = so->so_rcv.sb_cc; ub->st_uid = so->so_cred->cr_uid; ub->st_gid = so->so_cred->cr_gid; return ((*so->so_proto->pr_usrreqs->pru_sense)(so, ub)); |
