mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 14:39:37 +00:00
Instead of just blindly setting -rw-rw-rw-:
o Set access mode to -r--r--r-- if SS_CANTRCVMORE is set and the receive buffer is empty. o Set access mode to --w--w--w- is SS_CANTSENDMORE is set. Discussed with: alfred
This commit is contained in:
parent
0b1c18e4cf
commit
d41c16130b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=62425
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user