Bill McCarthy wrote:

> I'm "alpha testing" software for Windows that archives files
> whenever they are opened for writing.  Testing with Gvim, I
> noticed that the program's log showed multiple "open for
> write" entries by simply opening a file with Gvim and doing
> a :wq command.
> 
> The author of the software wrote:
> 
>     I downloaded Gvim and traced its file writes -- it
>     actually is opening the file for writing *4* times
>     for each save.  (Why, I can't begin to imagine, but
>     it's the sort of thing you get when you port between
>     various OS's without redoing the code.)
> 
>     I've made some changes to build 6 so that it will
>     only archive it & log it once, ignoring the
>     duplicates.
> 
> Why isn't opening the file for writing just once good
> enough?

Well, look in the source code: src/fileio.c, search for "open(".  Isn't
at least one of the writes for the backup file?

-- 
Would you care for a drink?   I mean, if it were, like,
disabled and you had to look after it?

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to