Posted: Mon Jul 19, 2004 12:43 am Post subject: My /var/tmp is full of junk
I was debugging a non-OpenOffice.org project the other day when I discovered a bunch of stuff in "/var/tmp". Some of it belonged to the project I was debugging, but the majority of it appeared to be from the OpenOffice.org project.
Specifically I am talking about temporary directories of the form :
Code:
sv001.tmp
On some of my systems, I have dozens of these directories. Almost always the contents have a creation date of 1969. I don't have handy the combined size of these directories.
I believe these directories are created by use of the mktemp() type functions, except I thought mktemp() defaulted to "/tmp" and not "/var/tmp".
Bottom line, "/tmp" is always cleared on a reboot, but "/var/tmp" is never cleared. Eventually one's disk could fill up with this useless junk.
In Mac OS X 10.0.x, multiple invocations of either the tempnam() or mktemp() system functions will return the same filename. On other platforms, these functions generate a unique filename with each invocation. This Mac OS X 10.0.x bug will cause unpredictable results at runtime.
The solution is to use the tmpnam() function instead of the tempnam() function and to use the mkstemp() function instead of the mktemp() function. Both tmpnam() and mkstemp() return a unique filename with each invocation. Note that since the default behavior for both tmpnam() and mkstemp() is to create their files in the /var/tmp directory, you need to make sure that the /var/tmp directory is readable and writable by all users. The Mac OS X 10.0.x installation program, /var/tmp is set to be readable and writable only by root.
I'm wondering if we still need to use this workaround in OpenOffice.org (and in case it is used in the OOo installer) now we no longer support anything earlier than Mac OS X 10.2.x.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum