Todd C. Miller(mill...@openbsd.org) on 2019.06.25 09:27:19 -0600: > On Tue, 25 Jun 2019 09:18:28 -0600, "Todd C. Miller" wrote: > > > The ERRORS section could be clearer as to what error you get when > > you try to lock a socket/fifo. > > Actually, for fcntl(2), we should be returning EINVAL, not EBADF > when trying to lock a non-file. Let's fix that first.
Well, if you do that, i think some callers need a look, for example usr.sbin/syslogd/syslogd.c:495: if (fcntl(fd, F_GETFL) == -1 && errno == EBADF) usr/bin/skeyaudit/skeyaudit.c:55: if (fcntl(dupfd, F_GETFL) == -1 && errno == EBADF) { usr/bin/skeyaudit/skeyaudit.c:108: if (iflag && fcntl(STDOUT_FILENO, F_GETFL) == -1 && errno == EBADF) usr/bin/ssh/misc.c:1156: if (fcntl(dupfd, F_GETFL) == -1 && errno == EBADF) { bin/ksh/io.c-264- if (errno == EBADF) isakmpd/isakmpd.c:377: if (fcntl(dupfd, F_GETFL) == -1 && errno == EBADF) { i might have missed some... > > - todd > > Index: sys/kern/kern_descrip.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_descrip.c,v > retrieving revision 1.185 > diff -u -p -u -r1.185 kern_descrip.c > --- sys/kern/kern_descrip.c 21 Jun 2019 09:39:48 -0000 1.185 > +++ sys/kern/kern_descrip.c 25 Jun 2019 15:22:55 -0000 > @@ -518,7 +518,7 @@ restart: > break; > > if (fp->f_type != DTYPE_VNODE) { > - error = EBADF; > + error = EINVAL; > break; > } > vp = fp->f_data; >