Cast longs to intptr_t before casting them to pointers.

Fixed bitrot in pseudo-declaration of `struct fcntl_args'.  fcntl()
is now broken in some cases when ints are larger than longs.
This commit is contained in:
Bruce Evans 1998-07-15 06:10:16 +00:00
parent fdb8d8965b
commit 1ede4662be
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37659

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
* $Id: kern_descrip.c,v 1.52 1998/05/11 03:55:24 dyson Exp $
* $Id: kern_descrip.c,v 1.53 1998/06/10 10:27:43 dfr Exp $
*/
#include "opt_compat.h"
@ -196,7 +196,7 @@ dup(p, uap)
struct fcntl_args {
int fd;
int cmd;
int arg;
long arg;
};
#endif
/* ARGSUSED */
@ -291,7 +291,8 @@ fcntl(p, uap)
return (EBADF);
vp = (struct vnode *)fp->f_data;
/* Copy in the lock structure */
error = copyin((caddr_t)uap->arg, (caddr_t)&fl, sizeof (fl));
error = copyin((caddr_t)(intptr_t)uap->arg, (caddr_t)&fl,
sizeof(fl));
if (error)
return (error);
if (fl.l_whence == SEEK_CUR)
@ -323,7 +324,8 @@ fcntl(p, uap)
return (EBADF);
vp = (struct vnode *)fp->f_data;
/* Copy in the lock structure */
error = copyin((caddr_t)uap->arg, (caddr_t)&fl, sizeof (fl));
error = copyin((caddr_t)(intptr_t)uap->arg, (caddr_t)&fl,
sizeof(fl));
if (error)
return (error);
if (fl.l_type != F_RDLCK && fl.l_type != F_WRLCK &&
@ -333,7 +335,8 @@ fcntl(p, uap)
fl.l_start += fp->f_offset;
if ((error = VOP_ADVLOCK(vp,(caddr_t)p,F_GETLK,&fl,F_POSIX)))
return (error);
return (copyout((caddr_t)&fl, (caddr_t)uap->arg, sizeof (fl)));
return (copyout((caddr_t)&fl, (caddr_t)(intptr_t)uap->arg,
sizeof(fl)));
default:
return (EINVAL);