Re: dhclient fails: can't open and lock /var/db/dhclient.leases.wlan0: Bad file descriptor

From: David Wolfskill <david_at_catwhisker.org>
Date: Fri, 10 Feb 2017 06:46:13 -0800
On Fri, Feb 10, 2017 at 04:10:41PM +0200, Konstantin Belousov wrote:
> ...
> Please try this.
> 
> diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
> index 70cdcdc6f75..1f2cceaf7a6 100644
> --- a/sys/kern/vfs_vnops.c
> +++ b/sys/kern/vfs_vnops.c
> _at__at_ -351,8 +351,8 _at__at_ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred,
>  
>  	while ((fmode & (O_EXLOCK | O_SHLOCK)) != 0) {
>  		KASSERT(fp != NULL, ("open with flock requires fp"));
> -		if (fp->f_type != DTYPE_VNODE) {
> -			error = EBADF;
> +		if (fp->f_type != DTYPE_NONE && fp->f_type != DTYPE_VNODE) {
> +			error = EOPNOTSUPP;
>  			break;
>  		}
>  		lock_flags = VOP_ISLOCKED(vp);
> diff --git a/sys/sys/file.h b/sys/sys/file.h
> index 353c92f365a..c51f26a41d2 100644
> --- a/sys/sys/file.h
> +++ b/sys/sys/file.h
> _at__at_ -53,6 +53,7 _at__at_ struct vnode;
>  
>  #endif /* _KERNEL */
>  
> +#define	DTYPE_NONE	0	/* not yet initialized */
>  #define	DTYPE_VNODE	1	/* file */
>  #define	DTYPE_SOCKET	2	/* communications endpoint */
>  #define	DTYPE_PIPE	3	/* pipe */


That seems to have done it -- thank you! :-)

Peace,
david
-- 
David H. Wolfskill				david_at_catwhisker.org
How could one possibly "respect" a misogynist, racist, bullying con-man??!?

See http://www.catwhisker.org/~david/publickey.gpg for my public key.

Received on Fri Feb 10 2017 - 13:46:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:10 UTC