On 5/6/08, David Rees <[EMAIL PROTECTED]> wrote:
> I did some checking in the PHP code - it does look like there are
>  various locations where the /conf/config.xml or
>  {$g['conf_path']}/config.xml or /cf/conf/config.xml are written just
>  using a plain fopen, write, close. This does leave you open to the
>  race condition I mentioned earlier where it's possible that another
>  process ends up reading a halfway written config file.

Yes and no.  Any config.xml operations are protected by config_lock()
and unlock().    Are you seeing a case where they are not?  Note:
write_config() automatically handles this behind the scenes.

>  I'll try to get the time to fix this properly - a generic "safe_write"
>  function which takes a filename as an argument, writes to a temporary
>  file in the same folder, then renames the temporary file over the
>  original filename should do the trick. Then it's just a matter of
>  finding all the places where the config file is written to and
>  replacing the those sections of code with the function call.

Might be a good idea.   I think we already have a wrapper for writing
a file in PHP so we just need to alter that code.

> No problem, I just need to find the time to do the first patch which
>  is pretty involved. Find a patch to check that the read configline was
>  successful to avoid the infinite loop on a corrupt config file. Seems
>  to work on my system.

Great, thanks for your help!

Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to