2007-03-16 Eric Blake <ebb9@byu.net>

* libc/stdio64/fseek064.c (_fseeko64_r): Fix reentrancy.
        * libc/stdio64/freopen64.c (_freopen64_r): Ditto.
This commit is contained in:
Jeff Johnston
2007-03-16 20:05:10 +00:00
parent 826b5591dd
commit a167bcd8e5
3 changed files with 12 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1990 The Regents of the University of California.
* Copyright (c) 1990, 2007 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
@ -197,7 +197,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence),
*/
if (fp->_bf._base == NULL)
__smakebuf (fp);
__smakebuf_r (ptr, fp);
if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT))
goto dumb;
if ((fp->_flags & __SOPT) == 0)
@ -283,7 +283,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence),
fp->_p = fp->_bf._base + o;
fp->_r = n - o;
if (HASUB (fp))
FREEUB (fp);
FREEUB (ptr, fp);
fp->_flags &= ~__SEOF;
_funlockfile(fp);
return 0;
@ -304,7 +304,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence),
fp->_r = 0;
fp->_p = fp->_bf._base;
if (HASUB (fp))
FREEUB (fp);
FREEUB (ptr, fp);
fp->_flags &= ~__SEOF;
n = target - curoff;
if (n)
@ -330,7 +330,7 @@ dumb:
}
/* success: clear EOF indicator and discard ungetc() data */
if (HASUB (fp))
FREEUB (fp);
FREEUB (ptr, fp);
fp->_p = fp->_bf._base;
fp->_r = 0;
/* fp->_w = 0; *//* unnecessary (I think...) */