2004-01-15 Thomas Pfaff <tpfaff@gmx.net>

* libc/stdio/fclose.c: Include sys/lock.h.
        (fclose): Destroy lock when file is closed.
        * libc/stdio/findfp.c (__sfp): Initialize file pointers _lock
        member.
        * libc/stdio/freopen.c: Include sys/lock.h.
        (_freopen_r): Destroy lock when file is closed.
        * libc/stdio/vfprintf.c (__sbprintf): Initialize file pointers
        _lock member.
This commit is contained in:
Jeff Johnston
2004-01-15 19:12:17 +00:00
parent d4c437af3e
commit 6a15098793
5 changed files with 27 additions and 0 deletions

View File

@ -71,6 +71,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <fcntl.h>
#include <stdlib.h>
#include "local.h"
#include <sys/lock.h>
/*
* Re-direct an existing, open (probably) file to some other file.
@ -150,6 +151,9 @@ _DEFUN (_freopen_r, (ptr, file, mode, fp),
fp->_flags = 0; /* set it free */
ptr->_errno = e; /* restore in case _close clobbered */
_funlockfile(fp);
#ifndef __SINGLE_THREAD__
__lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock);
#endif
return NULL;
}