soo_stat: Ensure error is always initialized.

In kernels without MAC, error is not set for sockets whose protocol
layer does not implement the pr_sense hook.

Reported by:	Jenkins (powerpc kernel builds)
Fixes:		7c04ca1fad sockets: for stat(2) on a socket don't report hiwat as block size
This commit is contained in:
John Baldwin 2022-08-26 11:17:55 -07:00
parent 74704a26bc
commit e3885a7893

View File

@ -303,7 +303,7 @@ static int
soo_stat(struct file *fp, struct stat *ub, struct ucred *active_cred)
{
struct socket *so = fp->f_data;
int error;
int error = 0;
bzero((caddr_t)ub, sizeof (*ub));
ub->st_mode = S_IFSOCK;