[openssl-dev] [openssl.org #1520] request for checking if -in and -out files are same
Aaron Jones via RT
rt at openssl.org
Sun Jun 14 06:09:47 UTC 2015
On 14/06/15 02:55, Rich Salz via RT wrote:
> One possiblity is open in exclusive mode. The problem is that O_EXCL is only
> part of open(2), not fopen(3). And we have to use fopen() because we need the
> "b" mode for binary output on platforms that require it. So I don't think that
> will work, either.
Do those platforms not have fdopen(3) with the same "b" semantics?
I note fdopen(3) is a POSIX thing, and "b" has no effect on POSIX
systems, so perhaps not. Worth a look though?
Failing that, you could fstat(3) the 2 open files and compare their
st_ino and st_dev fields for equality before writing anything to either
of them.
--
Aaron Jones
More information about the openssl-dev
mailing list