On Wed, Dec 05, 2001 at 06:02:49AM +1000, Greg Black wrote:
> Matthew Dillon wrote:
> 
> | :In message <[EMAIL PROTECTED]>, Bernd Walter writes:
> | :>> Is there any reason we don't want to truncate the file? Does O_TRUNC
> | :>> not work well of the file is a tape device or something?
> | :>
> | :>I don't expect O_TRUNK to work on devices such tapes and disks.
> | :
> | :Well, it won't achieve anything on tapes or disk devices, but it
> | :should be completely harmless to add the O_TRUNC flag. The current
> | :behaviour is likely to be unexpected and cause confusion so it
> | :might as well be changed. I'll commit this later unless someone
> | :can think of a good reason not to.
> | :
> | :Ian
> | 
> |     Woa!  That sounds like a bad idea to me.  If you want to do it right
> |     then open(), fstat(), and only if the stat says it is a regular file
> |     do you then ftruncate().  Passing O_TRUNC to a tape device may be ignored
> |     by us, but it's not a valid flag to pass to a tape device and we shouldn't
> |     do it.
> 
> I haven't used any of them for a while, but there are certainly
> Unix systems that treat O_TRUNC as a signal to rewind a tape
> device before writing to it.

So? Who cares? This is FreeBSD's dump(8) and FreeBSD's write(2). There
is no reason to worry about portability of FreeBSD's dump(8) in how
write(2) flags work. If our write(2) "does the right thing" with
O_TRUNC and tape devices, there is no reason not to let it do the
right thing on its own.
-- 
Crist J. Clark                     |     [EMAIL PROTECTED]
                                   |     [EMAIL PROTECTED]
http://people.freebsd.org/~cjc/    |     [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to