Query about P1003.2 'cp' utility

John T Kohl jtkohl at MIT.EDU
Sat Sep 8 02:25:05 AEST 1990

From:  jtkohl at MIT.EDU (John T Kohl)

In article <490 at usenix.ORG> caywood at teb.larc.nasa.gov (John Caywood) writes:
> I take this to mean that, no, cp doesn't unlink an existing file, but
> it truncates it upon opening under these conditions.  Consequently,
> yes, djm is correct, cp doesn't unlink.  I don't understand, though,
> why opening with O_TRUNC isn't equivalent.

Consider the case where the file in question has several hard links from
different filenames.  O_TRUNC is not equivalent to unlink.
John Kohl <jtkohl at ATHENA.MIT.EDU> or <jtkohl at MIT.EDU>
Digital Equipment Corporation/Project Athena
(The above opinions are MINE.  Don't put my words in somebody else's mouth!)

Volume-Number: Volume 21, Number 88

More information about the Comp.std.unix mailing list