http://bugs.winehq.org/show_bug.cgi?id=3613
------- Additional Comments From hans@it.vu.nl 2005-18-10 06:00 ------- I can reproduce this here. It's not a bug in tmpfile() but a configuration problem. A "trace+msvcrt,file" log shows that tmpfile() generates a bare filename like "\s8.", like it should.
But then when it tries to open it Wine will resolve this to an absolute Unix path, which becomes something like "/home/user/.wine/dosdevices/z:/\s8." on a default Wine installation.
Since z: is mapped to / the call will fail for unprivileged users, because they don't have write permission in /. On Windows I think the temporary filename will resolve to "c:\s8" and if I'm not mistaken everyone is allowed to write to c: on Windows.
Indeed, if I remove the symbolic link z: (so that the directory that c: points to becomes topmost) your program doesn't crash.