On 03/04/18(Tue) 16:59, Mark Kettenis wrote:
> > Date: Tue, 3 Apr 2018 16:48:09 +0200
> > From: Martin Pieuchot <m...@openbsd.org>
> > 
> > Similar to other diffs, this one move a FREF() right after
> > fd_getfile_mode(), ok?
> > 
> > Index: kern/sys_generic.c
> > ===================================================================
> > RCS file: /cvs/src/sys/kern/sys_generic.c,v
> > retrieving revision 1.116
> > diff -u -p -r1.116 sys_generic.c
> > --- kern/sys_generic.c      2 Jan 2018 06:38:45 -0000       1.116
> > +++ kern/sys_generic.c      3 Apr 2018 13:32:32 -0000
> > @@ -393,29 +393,30 @@ sys_ioctl(struct proc *p, void *v, regis
> >     struct file *fp;
> >     struct filedesc *fdp;
> >     u_long com = SCARG(uap, com);
> > -   int error;
> > +   int error = 0;
> >     u_int size;
> > -   caddr_t data, memp;
> > +   caddr_t data, memp = NULL;
> >     int tmp;
> >  #define STK_PARAMS 128
> >     long long stkbuf[STK_PARAMS / sizeof(long long)];
> >  
> >     fdp = p->p_fd;
> > -   fp = fd_getfile_mode(fdp, SCARG(uap, fd), FREAD|FWRITE);
> > -
> > -   if (fp == NULL)
> > +   if ((fp = fd_getfile_mode(fdp, SCARG(uap, fd), FREAD|FWRITE)) == NULL)
> >             return (EBADF);
> 
> I find that assignments within if statements make code harder to read.

I agree but that's coherent with the rest of the file.  I don't mind
changing it though.

Anything else?

Reply via email to