On Wed, Sep 26, 2012 at 5:55 AM, Simon Slavin <slav...@bigfraud.org> wrote:
>
> On 26 Sep 2012, at 5:42am, Dan Kennedy <danielk1...@gmail.com> wrote:
>
>> So when SQLite requires a temporary
>> file, it normally creates and opens a file with a randomized name
>> in /tmp then calls unlink() on it immediately - before it starts
>> using the file.
>
> Goodness me.  Okay, I wasn't aware that SQLite used this trick.  Thanks for 
> the correction.  That certainly does tie in with what the OP reported.
>
> There are problems with doing this under some versions of Unix/Linux, and 
> especially variants like Android.

I wonder what problems do you have in mind?

> For instance, another user/app can make a file with the same name.

If it doesn't happen in between file creation and unlinking then
there's absolutely no problem in this -- this app will see a different
file, not the one that SQLite sees. And with name randomization and
extremely short time between creation and unlinking there virtually no
chances to have any problems of this type.

> Or the system may crash while the file is still open.

What's the problem with this? File will be deleted by the file system
after reboot. To the contrary this scenario will give you problems if
you don't do unlinking.

> Is there any chance that the use of this trick can be discontinued ?

Hopefully you have some compelling reason for suggesting that.


Pavel
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to