On 3/5/10, Robert K. [email protected] wrote:
Thanks for the link. If I understand all this right this cannot be
fixed as long as a) there are two processes involved or b) the second
process (dot) cannot be made inherit the file descriptor. An
I think its ok if the parent process creates the temp file and then
the child writes its output to the existing temp file. As long as the
file isn’t deleted in between those two events. And that’s if the
child process doesn’t object to overwriting an existing file.
alternative approach would avoid a shared directory like /tmp and
write the output in $HOME/…/somewhere - which might be slower
because /tmp is often mounted in RAM. Maybe it helps to create a
directory in /tmp which is owned by and only accessible to $USER; then
create the tempfiles in that directory.
That should work too. Just be sure that you don’t ignore EEXIST when
creating the temp directory. Try with a different name instead.