[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Re: [zzdev] Temp File Fix!

On Thu, Oct 08, 1998 at 11:40:40AM +1000, Gossamer wrote:
> (gosh I'm fast!)

You certainly are!  Well done.

> 1.  To fix it so that different people can use ZZ at once:
> Find the line that says
> my $TEMP_FILE = "/tmp/zigzag"; # Filename used for external editing
> (it's up the top someplace)  and change it to this:
> my $TEMP_FILE = "/tmp/zigzag.$$"; # Filename used for external editing
> IE: add a period and two dollar signs.

If the /tmp directory is shared across the LAN, as it appears may be the
case at Keio, it is possible that two machines may have the same process ID.
So I suggest using the following code instead:

my $TEMP_FILE = "/tmp/zigzag-$<-$^T"; # Filename used for external editing

This will use the user ID (probably the same across the LAN, though not
necessarily) and the time zigzag was started.

> 2.  Persistant files
> Is this perhaps an old version?  Mine doesn't do this ...

I've looked at the code, and it does erase the temporary files.  However,
the /tmp directory normally has the sticky bit set.  The behaviour of
the sticky bit is apparently not specified by POSIX and can vary from
OS to OS.  Under Linux it just means that only the owner of the file
can erase it; under other operating systems it might have a different
meaning, perhaps that only root can erase the file.

	*** Xanni ***
mailto:xanni@xxxxxxxxxx                         Andrew Pam
http://www.xanadu.com.au/                       Technical VP, Xanadu
http://www.glasswings.com.au/                   Technical Editor, Glass Wings
http://www.sericyb.com.au/sc/                   Manager, Serious Cybernetics
P.O. Box 26, East Melbourne VIC 8002 Australia  Phone +61 3 96511511