X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..refs/heads/master:/stdio/FreeBSD/rewind.c?ds=inline diff --git a/stdio/FreeBSD/rewind.c b/stdio/FreeBSD/rewind.c index b5204ed..33aea2f 100644 --- a/stdio/FreeBSD/rewind.c +++ b/stdio/FreeBSD/rewind.c @@ -49,13 +49,12 @@ rewind(FILE *fp) int serrno = errno; /* make sure stdio is set up */ - if (!__sdidinit) - __sinit(); + pthread_once(&__sdidinit, __sinit); FLOCKFILE(fp); if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) { - clearerr_unlocked(fp); errno = serrno; } + clearerr_unlocked(fp); /* POSIX: clear stdio error regardless */ FUNLOCKFILE(fp); }