logo separator

[mkgmap-dev] possible problem if output dir doesn't exist

From Steve Ratcliffe steve at parabola.me.uk on Sat Aug 24 10:48:28 BST 2013

Hi Gerd

> I've just noted for the first time that mkgmap may fail if the output
> directory doesn't exist and -max-jobs is used.

> to be fixed with a threadlocal variable?

A thread local variable is almost never the correct way to fix a thread 
problem.

I think that in this case where the return from mkdirs() does
not distinguish between failure and directory already existing
we should just ignore the return value and test if the directory
does actually exist afterwards.

Patch attached. Of course there can still be multiple messages, but
I don't see that as a problem.

Could remove the message about creating the directory altogether, in 
which case the 'if exists' part could be removed too since mkdirs() 
tests if the directory exists as the first thing it does itself.

..Steve

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Race_on_create_directory_.patch
Type: text/x-patch
Size: 741 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20130824/0df754e5/attachment.bin 


More information about the mkgmap-dev mailing list