Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 2005 06:30:15 GMT
From:      David Xu <davidxu@freebsd.org>
To:        freebsd-threads@FreeBSD.org
Subject:   Re: threads/79887: [patch] freopen() isn't thread-safe
Message-ID:  <200512290630.jBT6UFUp073622@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR threads/79887; it has been noted by GNATS.

From: David Xu <davidxu@freebsd.org>
To: Dmitrij Tejblum <tejblum@yandex-team.ru>
Cc: bug-followup@freebsd.org
Subject: Re: threads/79887: [patch] freopen() isn't thread-safe
Date: Thu, 29 Dec 2005 14:23:39 +0800

 Dmitrij Tejblum wrote:
 >
 > Well, this is C, not C++, so there cannot be strict difference between 
 > allowed and disallowed. But the _close field is not required by any 
 > standarts (funopen() too) and is not documented by manpages (I checked 
 > manpages with grep). And there does exist documented interface for 
 > setting _close: funopen(). Thus _close is internal.
 > 
 > 
 > 
 Then why use the following code to close a file descriptor,
 if (isopen)
 	(void) (*fp->_close)(fp->_cookie);
 
 Why don't use _close(fp->_file)? this should be faster.
 This implies that someone can replace fp->_close with another function
 pointer,so that function must be called unconditionally. I think the
 libc should have a document to clarify this problem. Also should we move
 the PR to freebsd-standard@ list ?
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512290630.jBT6UFUp073622>