Date: Fri, 10 Feb 2017 06:46:13 -0800 From: David Wolfskill <david@catwhisker.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: Iblis Lin <iblis@hs.ntnu.edu.tw>, current@freebsd.org Subject: Re: dhclient fails: can't open and lock /var/db/dhclient.leases.wlan0: Bad file descriptor Message-ID: <20170210144613.GH1523@albert.catwhisker.org> In-Reply-To: <20170210141041.GR2092@kib.kiev.ua> References: <20170210132954.GE1523@albert.catwhisker.org> <20170210141041.GR2092@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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
> @@ -351,8 +351,8 @@ 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
> @@ -53,6 +53,7 @@ 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@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.
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQF8BAEBCgBmBQJYndI1XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRDQ0I3Q0VGOTE3QTgwMUY0MzA2NEQ3N0Ix
NTM5Q0M0MEEwNDlFRTE3AAoJEBU5zECgSe4XUgYH/iOqXjn3WrkxgTh6kOwbzig4
phBZdj4US2yNBn4N86pBOWH9XByN5EhllosnKOLg/EHmHMDJDWLzpEjua2kbBLDJ
BJG1Sz4rAVaLWpcE54q/oL0c4ZBufXsDgUF+DbRRGQOF4rfzUHhu8isYtePqqhae
u1/7YlAGG8+o9dWExeCLtoFK2ADclxF+HQvSegSfwXj2xuv8qF70PYr49mDtCjak
6k4ttJSkQIsVVczDfFoYHAZVqsH3nxoOQHve8Vgc5QlIy65KQGvMQbIL7BaXSxFr
RF8qI0IoGq08C0TpuMK6rcITKEWtE7tg8hqz4hm2xFqL7KCMYpIwyGXA4gJVZQU=
=8zAk
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170210144613.GH1523>
