Hi Enrico,
On Wed, 2007-04-25 at 19:03 +1200, Enrico de Klerk wrote:
> I think the race condition can be removed by doing something like this
> (It's similar to what mkstemp does):
>
> while True:
> try:
> fd = os.open(os.path.join(settings.MEDIA_ROOT, filename),
> os.O_RDWR | os.O_C
I think the race condition can be removed by doing something like this
(It's similar to what mkstemp does):
while True:
try:
fd = os.open(os.path.join(settings.MEDIA_ROOT, filename),
os.O_RDWR | os.O_CREAT | os.O_EXCL)
fp = os.fdopen(fd, 'wb')
fp.write(raw_contents)
On Tue, 2007-04-24 at 21:06 +1200, Enrico de Klerk wrote:
> Hi there,
>
> I've noticed a possible race condition in django/db/models/base.py.
>
> When a file field is saved in the _save_FIELD_file function it first
> checks whether a file with the same name already exists, and then adds
> unders
Hi there,
I've noticed a possible race condition in django/db/models/base.py.
When a file field is saved in the _save_FIELD_file function it first
checks whether a file with the same name already exists, and then adds
underscores to the filename until it generates a unique name and then
saves th
4 matches
Mail list logo