Deleted Added
full compact
rewind.c (81817) rewind.c (82743)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 25 unchanged lines hidden (view full) ---

34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38#if 0
39static char sccsid[] = "@(#)rewind.c 8.1 (Berkeley) 6/4/93";
40#endif
41static const char rcsid[] =
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 25 unchanged lines hidden (view full) ---

34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38#if 0
39static char sccsid[] = "@(#)rewind.c 8.1 (Berkeley) 6/4/93";
40#endif
41static const char rcsid[] =
42 "$FreeBSD: head/lib/libc/stdio/rewind.c 81817 2001-08-17 09:57:11Z ache $";
42 "$FreeBSD: head/lib/libc/stdio/rewind.c 82743 2001-09-01 15:28:24Z ache $";
43#endif /* LIBC_SCCS and not lint */
44
45#include "namespace.h"
46#include <errno.h>
47#include <stdio.h>
48#include "un-namespace.h"
49#include "libc_private.h"
50#include "local.h"
51
52void
53rewind(FILE *fp)
54{
43#endif /* LIBC_SCCS and not lint */
44
45#include "namespace.h"
46#include <errno.h>
47#include <stdio.h>
48#include "un-namespace.h"
49#include "libc_private.h"
50#include "local.h"
51
52void
53rewind(FILE *fp)
54{
55 int serrno = errno;
56
55 /* make sure stdio is set up */
56 if (!__sdidinit)
57 __sinit();
58
59 FLOCKFILE(fp);
57 /* make sure stdio is set up */
58 if (!__sdidinit)
59 __sinit();
60
61 FLOCKFILE(fp);
60 if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0)
62 if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) {
61 clearerr_unlocked(fp);
63 clearerr_unlocked(fp);
64 errno = serrno;
65 }
62 FUNLOCKFILE(fp);
66 FUNLOCKFILE(fp);
63 /* errno required by POSIX to sense error, don't zero it here */
64}
67}