1169691Skan/*- 2117397Skan * Copyright (c) 1990, 1993 3117397Skan * The Regents of the University of California. All rights reserved. 4117397Skan * 5117397Skan * This code is derived from software contributed to Berkeley by 6117397Skan * Chris Torek. 7117397Skan * 8117397Skan * Redistribution and use in source and binary forms, with or without 9117397Skan * modification, are permitted provided that the following conditions 10117397Skan * are met: 11117397Skan * 1. Redistributions of source code must retain the above copyright 12117397Skan * notice, this list of conditions and the following disclaimer. 13117397Skan * 2. Redistributions in binary form must reproduce the above copyright 14117397Skan * notice, this list of conditions and the following disclaimer in the 15117397Skan * documentation and/or other materials provided with the distribution. 16117397Skan * 3. Neither the name of the University nor the names of its contributors 17169691Skan * may be used to endorse or promote products derived from this software 18169691Skan * without specific prior written permission. 19117397Skan * 20117397Skan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21117397Skan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22117397Skan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23117397Skan * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24117397Skan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25117397Skan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26117397Skan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27117397Skan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28117397Skan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29117397Skan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30169691Skan * SUCH DAMAGE. 31117397Skan */ 32169691Skan 33117397Skan#if defined(LIBC_SCCS) && !defined(lint) 34169691Skanstatic char sccsid[] = "@(#)ferror.c 8.1 (Berkeley) 6/4/93"; 35169691Skan#endif /* LIBC_SCCS and not lint */ 36169691Skan#include <sys/cdefs.h> 37169691Skan__FBSDID("$FreeBSD: releng/10.3/lib/libc/stdio/ferror.c 249808 2013-04-23 13:33:13Z emaste $"); 38117397Skan 39169691Skan#include "namespace.h" 40169691Skan#include <stdio.h> 41169691Skan#include "un-namespace.h" 42169691Skan#include "libc_private.h" 43169691Skan 44169691Skan#undef ferror 45169691Skan#undef ferror_unlocked 46169691Skan 47169691Skanint 48169691Skanferror(FILE *fp) 49169691Skan{ 50169691Skan int ret; 51169691Skan 52169691Skan FLOCKFILE(fp); 53169691Skan ret = __sferror(fp); 54169691Skan FUNLOCKFILE(fp); 55169691Skan return (ret); 56169691Skan} 57169691Skan 58169691Skanint 59169691Skanferror_unlocked(FILE *fp) 60169691Skan{ 61169691Skan 62169691Skan return (__sferror(fp)); 63169691Skan} 64169691Skan