[openssl-dev] [openssl.org #1520] request for checking if -in and -out files are same

Richard Levitte via RT rt at openssl.org
Wed May 18 19:17:10 UTC 2016


Considering we've now solved all the binary vs non-binary issues and know how
to do that at open(2) level where it's relevant, adding O_EXCL shouldn't be
much of a problem any more. This should, however, not be done on file systems
that support file generations (VMS, and...?)

Cheers,
Richard

On Sun Jun 14 06:09:47 2015, aaronmdjones at gmail.com wrote:
> 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.


--
Richard Levitte
levitte at openssl.org

-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=1520
Please log in as guest with password guest if prompted



More information about the openssl-dev mailing list