Query about P1003.2 'cp' utility

John Cowan cowan at marob.masa.com
Sat Sep 8 02:12:07 AEST 1990


From:  cowan at marob.masa.com (John Cowan)

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.

The difference between unlinking before opening and opening with O_TRUNC is,
of course, that the former course of action can change the file's owner,
group, and mode settings, whereas the latter course of action cannot.
-- 
cowan at marob.masa.com			(aka ...!hombre!marob!cowan)
			e'osai ko sarji la lojban

Volume-Number: Volume 21, Number 90



More information about the Comp.std.unix mailing list