rewind.c (d201fe46e355212750b727061e6a7ac005267852) | rewind.c (71b5a4326ddbfff4f2f249acea228dc5e642dd62) |
---|---|
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 --- 38 unchanged lines hidden (view full) --- 47#include <stdio.h> 48#include "un-namespace.h" 49#include "libc_private.h" 50#include "local.h" 51 52void 53rewind(FILE *fp) 54{ | 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 --- 38 unchanged lines hidden (view full) --- 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 /* make sure stdio is set up */ 56 if (!__sdidinit) 57 __sinit(); 58 |
|
55 FLOCKFILE(fp); | 59 FLOCKFILE(fp); |
56 (void) _fseeko(fp, (off_t)0, SEEK_SET); 57 clearerr(fp); | 60 if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) 61 clearerr_unlocked(fp); |
58 FUNLOCKFILE(fp); | 62 FUNLOCKFILE(fp); |
59 errno = 0; /* not required, but seems reasonable */ | 63 /* errno required by POSIX to sense error, don't zero it here */ |
60} | 64} |