On Tue, 11 Jun 2002, Muli Ben-Yehuda wrote:
> > > I need to open a temporary file (but with a fixed name, so mkstemp() > > > and friends are not an option) > > > > Why a fixed name? Can it be a symlink? > > Because I'm doing it as part of syscalltrack's test suite, and it > needs to be a fixed name so that I'll be able to make rules to match > on it. We do support pattern matching, so I could use mkstemp() with a > fixed template, but I would like to test our '==' operator, not just > '=~'. who might 'pull the file below our feet'? what i'd suggest (pitty we didn't do that long ago) is create a directory, chdir to it, and in _that_ directory perform all of the testing. this way, you could eventually just recursively remove the directory during cleanup. for mode changing, there is 'fchmod'. for exec, there is 'fexecv'. but there is no 'funlink', i'm afraid. > It can be a symlink, I guess. How does this help? > > > > and then make sure it doesn't remain > > > behind if the program should die unexpectedly. > > This brings up another interesting question: how do I make sure all > stray files are cleaned up properly on abnormal program termination? > Adding a sighandler for each possible signal is annoying (although > doable) - is there a better way? no. just set all signals to be served by the same signal handler. -- guy "For world domination - press 1, or dial 0, and please hold, for the creator." -- nob o. dy ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]