On Mon, Jan 07 2019 16:32:31 -0500, Ted Unangst wrote: > > > This doubles the number of synchronous > > > file operations. > > > > Does it? Without safecopy, the operations performed are: > > > > unlink(targetfile); > > open(targetfile, O_CREAT|O_EXCL); > > write(); > > fchmod(); > > close(); > > > > with safecopy, they are: > > > > open(tempfile, O_CREAT|O_EXCL); > > write(); > > fchmod(); > > close(); > > rename(tempfile, targetfile); > > > > which to me seems identical in the number of file syscalls made. > > oh, I think I forgot to count the unlink(). rename() within a directory is > about the same cost as unlink(), so the two cases do seem equal.
great, we're on the same page :) here's an additional manpage adjustment on top, that I somehow missed the first time around. diff --git a/usr.bin/xinstall/install.1 b/usr.bin/xinstall/install.1 index f7d8707ce6f..64f99504752 100644 --- a/usr.bin/xinstall/install.1 +++ b/usr.bin/xinstall/install.1 @@ -101,7 +101,7 @@ Create directories. Missing parent directories are created as required. This option cannot be used with the .Fl B , b , C , c , -.Fl f , p , S , +.Fl f , p , or .Fl s options. @@ -198,9 +198,8 @@ The .Fl C , .Fl D , .Fl F , -.Fl p , and -.Fl S +.Fl p flags are non-standard and should not be relied upon for portability. .Pp Temporary files may be left in the target directory if -- Lauri Tirkkonen | lotheac @ IRCnet