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:
parent
fdb8d8965b
commit
1ede4662be
@ -36,7 +36,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
|
* @(#)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"
|
#include "opt_compat.h"
|
||||||
@ -196,7 +196,7 @@ dup(p, uap)
|
|||||||
struct fcntl_args {
|
struct fcntl_args {
|
||||||
int fd;
|
int fd;
|
||||||
int cmd;
|
int cmd;
|
||||||
int arg;
|
long arg;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
@ -291,7 +291,8 @@ fcntl(p, uap)
|
|||||||
return (EBADF);
|
return (EBADF);
|
||||||
vp = (struct vnode *)fp->f_data;
|
vp = (struct vnode *)fp->f_data;
|
||||||
/* Copy in the lock structure */
|
/* 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)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
if (fl.l_whence == SEEK_CUR)
|
if (fl.l_whence == SEEK_CUR)
|
||||||
@ -323,7 +324,8 @@ fcntl(p, uap)
|
|||||||
return (EBADF);
|
return (EBADF);
|
||||||
vp = (struct vnode *)fp->f_data;
|
vp = (struct vnode *)fp->f_data;
|
||||||
/* Copy in the lock structure */
|
/* 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)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
if (fl.l_type != F_RDLCK && fl.l_type != F_WRLCK &&
|
if (fl.l_type != F_RDLCK && fl.l_type != F_WRLCK &&
|
||||||
@ -333,7 +335,8 @@ fcntl(p, uap)
|
|||||||
fl.l_start += fp->f_offset;
|
fl.l_start += fp->f_offset;
|
||||||
if ((error = VOP_ADVLOCK(vp,(caddr_t)p,F_GETLK,&fl,F_POSIX)))
|
if ((error = VOP_ADVLOCK(vp,(caddr_t)p,F_GETLK,&fl,F_POSIX)))
|
||||||
return (error);
|
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:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
Loading…
Reference in New Issue
Block a user