flush so that the offset will be correct on streams opened in
append mode (from chris torek).
This commit is contained in:
parent
e924f34f97
commit
38937f73d0
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fseek.c,v 1.7 1995/02/02 02:09:39 jtc Exp $ */
|
||||
/* $NetBSD: fseek.c,v 1.8 1995/03/05 06:56:09 jtc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -40,7 +40,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)fseek.c 8.3 (Berkeley) 1/2/94";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: fseek.c,v 1.7 1995/02/02 02:09:39 jtc Exp $";
|
||||
static char rcsid[] = "$NetBSD: fseek.c,v 1.8 1995/03/05 06:56:09 jtc Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -93,6 +93,7 @@ fseek(fp, offset, whence)
|
||||
* we have to first find the current stream offset a la
|
||||
* ftell (see ftell for details).
|
||||
*/
|
||||
__sflush(fp); /* may adjust seek offset on append stream */
|
||||
if (fp->_flags & __SOFF)
|
||||
curoff = fp->_offset;
|
||||
else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ftell.c,v 1.4 1995/02/02 02:09:42 jtc Exp $ */
|
||||
/* $NetBSD: ftell.c,v 1.5 1995/03/05 06:56:11 jtc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -40,7 +40,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ftell.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: ftell.c,v 1.4 1995/02/02 02:09:42 jtc Exp $";
|
||||
static char rcsid[] = "$NetBSD: ftell.c,v 1.5 1995/03/05 06:56:11 jtc Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -65,6 +65,7 @@ ftell(fp)
|
||||
* Find offset of underlying I/O object, then
|
||||
* adjust for buffered bytes.
|
||||
*/
|
||||
__sflush(fp); /* may adjust seek offset on append stream */
|
||||
if (fp->_flags & __SOFF)
|
||||
pos = fp->_offset;
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user