clrerr.c revision 330897
1141527Snjl/*-
2141527Snjl * SPDX-License-Identifier: BSD-3-Clause
3141527Snjl *
4141527Snjl * Copyright (c) 1990, 1993
5141527Snjl *	The Regents of the University of California.  All rights reserved.
6141527Snjl *
7141527Snjl * This code is derived from software contributed to Berkeley by
8141527Snjl * Chris Torek.
9141527Snjl *
10141527Snjl * Redistribution and use in source and binary forms, with or without
11141527Snjl * modification, are permitted provided that the following conditions
12141527Snjl * are met:
13141527Snjl * 1. Redistributions of source code must retain the above copyright
14141527Snjl *    notice, this list of conditions and the following disclaimer.
15141527Snjl * 2. Redistributions in binary form must reproduce the above copyright
16141527Snjl *    notice, this list of conditions and the following disclaimer in the
17141527Snjl *    documentation and/or other materials provided with the distribution.
18141527Snjl * 3. Neither the name of the University nor the names of its contributors
19141527Snjl *    may be used to endorse or promote products derived from this software
20141527Snjl *    without specific prior written permission.
21141527Snjl *
22141527Snjl * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23141527Snjl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24141527Snjl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25141527Snjl * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26141527Snjl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27162404Sru * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28141527Snjl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29141527Snjl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30141527Snjl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31141527Snjl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32141527Snjl * SUCH DAMAGE.
33141527Snjl */
34141527Snjl
35141527Snjl#if defined(LIBC_SCCS) && !defined(lint)
36141527Snjlstatic char sccsid[] = "@(#)clrerr.c	8.1 (Berkeley) 6/4/93";
37141527Snjl#endif /* LIBC_SCCS and not lint */
38141840Sru#include <sys/cdefs.h>
39141527Snjl__FBSDID("$FreeBSD: stable/11/lib/libc/stdio/clrerr.c 330897 2018-03-14 03:19:51Z eadler $");
40141840Sru
41141527Snjl#include "namespace.h"
42141840Sru#include <stdio.h>
43141527Snjl#include "un-namespace.h"
44141527Snjl#include "libc_private.h"
45141527Snjl
46141527Snjl#undef clearerr
47141527Snjl#undef clearerr_unlocked
48141527Snjl
49141527Snjlvoid
50142033Snjlclearerr(FILE *fp)
51142033Snjl{
52141840Sru	FLOCKFILE(fp);
53141527Snjl	__sclearerr(fp);
54141840Sru	FUNLOCKFILE(fp);
55141527Snjl}
56141527Snjl
57141527Snjlvoid
58141527Snjlclearerr_unlocked(FILE *fp)
59141527Snjl{
60141527Snjl
61141527Snjl	__sclearerr(fp);
62141527Snjl}
63141527Snjl