-/* $NetBSD: fseeko.c,v 1.5 2005/03/04 16:04:58 dsl Exp $ */\r
+/*\r
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials are licensed and made available\r
+ under the terms and conditions of the BSD License that accompanies this\r
+ distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-/*-\r
* Copyright (c) 1990, 1993\r
* The Regents of the University of California. All rights reserved.\r
*\r
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
* SUCH DAMAGE.\r
+\r
+ NetBSD: fseeko.c,v 1.5 2005/03/04 16:04:58 dsl Exp\r
*/\r
//#include <Uefi.h> // REMOVE, For DEBUG only\r
//#include <Library/UefiLib.h> // REMOVE, For DEBUG only\r
\r
#include <LibConfig.h>\r
#include <sys/EfiCdefs.h>\r
-#if defined(LIBC_SCCS) && !defined(lint)\r
-__RCSID("$NetBSD: fseeko.c,v 1.5 2005/03/04 16:04:58 dsl Exp $");\r
-#endif /* LIBC_SCCS and not lint */\r
\r
#include "namespace.h"\r
#include <sys/types.h>\r
int havepos;\r
\r
_DIAGASSERT(fp != NULL);\r
+ if(fp == NULL) {\r
+ errno = EINVAL;\r
+ return -1;\r
+ }\r
\r
#ifdef __GNUC__\r
/* This outrageous construct just to shut up a GCC warning. */\r
fp->_r = (int)(n - o);\r
if (HASUB(fp))\r
FREEUB(fp);\r
+ WCIO_FREE(fp); /* Should this really be unconditional??? */\r
fp->_flags &= ~__SEOF;\r
FUNLOCKFILE(fp);\r
return (0);\r
fp->_p = fp->_bf._base;\r
if (HASUB(fp))\r
FREEUB(fp);\r
+ WCIO_FREE(fp); /* Should this really be unconditional??? */\r
fp->_flags &= ~__SEOF;\r
n = (int)(target - curoff);\r
if (n) {\r
/* success: clear EOF indicator and discard ungetc() data */\r
if (HASUB(fp))\r
FREEUB(fp);\r
+ WCIO_FREE(fp); /* Should this really be unconditional??? */\r
fp->_p = fp->_bf._base;\r
fp->_r = 0;\r
- /* fp->_w = 0; */ /* unnecessary (I think...) */\r
+ fp->_w = 0;\r
fp->_flags &= ~__SEOF;\r
FUNLOCKFILE(fp);\r
//Print(L"%a: %d\n", __func__, __LINE__);\r