http://bugs.winehq.org/show_bug.cgi?id=17318
--- Comment #4 from Damjan Jovanovic damjan.jov@gmail.com 2009-03-04 09:13:17 --- 1. mkstemp() doesn't give you the filename, and there is no way to get the filename from the fd without fstat() + an exhaustive search of the entire filesystem. The filename is required to rename() the file later.
2 and 3. Creating the file in the data dir is necessary to ensure rename() works, since /tmp might be on a different filesystem. The loop with mkstemp() and the open() with O_EXCL should prevent all concurrency issues. And even if that directory is on NFS (causing open + O_EXCL to always pass), the semaphore held by winemenubuilder will prevent concurrent winemenubuilder invocations for the same wineserver from clobbering each other.
Does that patch I posted earlier work?