In fgetpos() and fsetpos(), use ftello() and fseeko(), respectively, to avoid
truncating the value stored in the fpos_t object operated on to that of a long integer; adresses PR lib/6637.
This commit is contained in:
parent
1a4d443770
commit
7c5b39585f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fgetpos.c,v 1.9 1999/09/20 04:39:26 lukem Exp $ */
|
||||
/* $NetBSD: fgetpos.c,v 1.10 2000/07/08 13:51:27 kleink Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -41,10 +41,11 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)fgetpos.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: fgetpos.c,v 1.9 1999/09/20 04:39:26 lukem Exp $");
|
||||
__RCSID("$NetBSD: fgetpos.c,v 1.10 2000/07/08 13:51:27 kleink Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
@ -57,5 +58,5 @@ fgetpos(fp, pos)
|
|||
_DIAGASSERT(fp != NULL);
|
||||
_DIAGASSERT(pos != NULL);
|
||||
|
||||
return((*pos = ftell(fp)) == (fpos_t)-1);
|
||||
return((*pos = (off_t)ftello(fp)) == (off_t)-1);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fsetpos.c,v 1.8 1999/09/20 04:39:29 lukem Exp $ */
|
||||
/* $NetBSD: fsetpos.c,v 1.9 2000/07/08 13:51:27 kleink Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -41,10 +41,11 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)fsetpos.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: fsetpos.c,v 1.8 1999/09/20 04:39:29 lukem Exp $");
|
||||
__RCSID("$NetBSD: fsetpos.c,v 1.9 2000/07/08 13:51:27 kleink Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
@ -60,5 +61,5 @@ fsetpos(iop, pos)
|
|||
_DIAGASSERT(iop != NULL);
|
||||
_DIAGASSERT(pos != NULL);
|
||||
|
||||
return (fseek(iop, (long)*pos, SEEK_SET));
|
||||
return (fseeko(iop, (off_t)*pos, SEEK_SET));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue